Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5002

Interfacing Mathematica and NI Vision using NETLink

From guillaume.lepert07@imperial.ac.uk
Newsgroups comp.soft-sys.math.mathematica
Subject Interfacing Mathematica and NI Vision using NETLink
Date 2011-09-16 09:58 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j4v6jr$ca2$1@smc.vnet.net> (permalink)

Show all headers | View raw


Hi,
I want to use the National instrument Imaq/Vision .NET assemblies to capture images directly into Mathematica. I can set up the camera and snap an image fine, but I run into trouble when I try to convert the NI Vision image into an array so I can transfer it to Mathematica from the .NET world.

I create an NIVision image like this:
  >> image = NETNew["NationalInstruments.Vision.VisionImage"]
and open the camera like this:
  >> session = NETNew[ImaqdxSession, "cam0"]
then I can snap a new frame from the camera like this
  >> session@Snap[image]
and I know it has worked because I can save the image to the HDD:
  >> image@WritePngFile["F:\\test1.png"]

So far so good. Now to export the image into an array, I do:
  >> image2 = image@ImageToArray[]
which triggers the exception:
"NET::netexcptn: "A .NET exception occurred: "System.NullReferenceException: Object reference not set to an instance of an object at NationalInstruments.Vision.PixelValue2D.GetHashCode()"

To better understand the problem I tried to create myself a PixelValue2D array (the type returned by the ImageToArray method as
  >> aa = NETNew["NationalInstruments.Vision.PixelValue2D", {{1,2},{3,4}}]
which triggers the same error.

I am truly stuck now! Help would be greatly appreciated! Thanks,
Guillaume.

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Interfacing Mathematica and NI Vision using NETLink guillaume.lepert07@imperial.ac.uk - 2011-09-16 09:58 +0000

csiph-web