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


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

Interfacing Mathematica and NI Vision using NETLink

Started byguillaume.lepert07@imperial.ac.uk
First post2011-09-16 09:58 +0000
Last post2011-09-16 09:58 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

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

#5002 — Interfacing Mathematica and NI Vision using NETLink

Fromguillaume.lepert07@imperial.ac.uk
Date2011-09-16 09:58 +0000
SubjectInterfacing Mathematica and NI Vision using NETLink
Message-ID<j4v6jr$ca2$1@smc.vnet.net>
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.

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web