08-05-2009 12:44 PM
CWIMAQVision.ReadImage() is throwing an exception every time I try to load a BMP in an assembly. The assembly is to read an image from the drive and perform some analysis on it - there's no UI. Here is my code:
CWIMAQVisionClass vision = new CWIMAQVisionClass();
CWIMAQImageClass image = new CWIMAQImageClass();
object missing = System.Type.Missing;
vision.ReadImage(image, fileName, missing); // Exception thrown here
... Throws the exception, evertime. As does passing null instead of System.Type.Missing. The included examples are for VB, and have a 2-parameter version of the ReadImage function, which work and can load my image.
In another thread, the solution was to use a viewer in the UI. I don't have a UI, so I tried it programatically... and it still throws the exception:
CWIMAQVisionClass vision = new CWIMAQVisionClass();
CWIMAQViewerClass viewer = new CWIMAQViewerClass();
vision.ReadImage(viewer.Image, redLEDFileName, viewer.Palette);
08-06-2009 06:36 PM