Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Maybe a bug? 6 code lines in C# regarding to frame extraction with NIMAQ... Why is it not working?

Please take a look at the next code in C#:

CWIMAQImage img = new CWIMAQImage();
img.Type = CWIMAQImageTypes.cwimaqImageTypeRGB32;
CWIMAQAVISession avi = new CWIMAQAVISession();
avi.Open(@"c:\video.avi");
avi.ReadFrame(img, 1, null);
axCWIMAQViewer1.Attach(img);

The readframe command throws a type mismatch exception,
Type mismatch (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)).

but when I write it in VB.NET, it works correctly!

Dim img as New CWIMAQImage()
Dim avi as New avi CWIMAQAVISession()
img.Type = CWIMAQImageTypes.cwimaqImageTypeRGB32
avi.Open("c:\video.avi")
avi.ReadFrame(img, 1)
axCWIMAQViewer1.Attach(img)

This code correctly displays image! I'm going crazy! Any ideas?



Mensaje editado por Alvaro Enriquez
0 Kudos
Message 1 of 1
(3,370 Views)