LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows/CVI IMAQ AVI FILES

I have a USB2 camera that I am using the company's  LIB to control and acquire images via LabWindows/CVI. 

Problem is I want to save the images into an AVI file in LabWINDOWS.  I get an error that I need to pass an image into the AVI FILE WRITE routing in IMAQ.   So how do I convert my buffer into an images so I can pass it into the AVI FILE WRITE routine?

thanks,
John.

0 Kudos
Message 1 of 6
(3,822 Views)

Hi John,

Are you using the AVI File Write form the library that you received from the LIB that came with your camera?  Or are you using the imaqWriteAVIFrame function?  If you are using that function, then you can only write one frame at a time.  You are probably passing an array of Images when you get that error.  If you index through the array and write one image at a time it should work. Also keep in mind that it must be the IMAQ data type.  The way to do that is to use the Array to Image function.  This function is only available in the Vision Development module. I hope this helps.

Have a great day,

GG

 
0 Kudos
Message 2 of 6
(3,798 Views)
Hey thanks for the reply.

I do have the NI VISION and found the Array to Image function but I still get some catch all error "Not an image".

I am establishing a memory buffer 

char *pCameraBuff;

pCameraBuff = (unsigned char *) malloc(framesize * 2):

\\ Then I grab my frames via USB2 and put them in the PCameraBuff

\\ Now I want to write them to an AVI FILE, I have already written to a RAW FILE so they don't get compressed...
but that is not useful for viewing


Thanks for any help.


0 Kudos
Message 3 of 6
(3,781 Views)

Hi,


The imaqWriteAVIFrame function is expecting an image data type.  The buffer you are using sounds like it contains an array of images.  So you will need to convert each image to the imaq data type one at a time.  And then each image needs to be passed into the imaqWriteAVIFrame function.  Is this what you already tried?  Also make sure that you are creating the AVI refnum by using the IMAQCreateAVI function.  You may want to try passing in an image from a file, to see if you get that same error with other images.  I hope this helps.

Have a great day,

GG 

0 Kudos
Message 4 of 6
(3,760 Views)
Thanks for your help in resolving this matter, I think its something very stupid I am overlooking 🙂  but

I am establishing a char buff that is 1 frame (752x480x2) little endian, so my buff size is 721920.  My first pixel has an intensity of 1023, 0000 0011 1111 1111, which is actually 10 bits so essentially saturated. 

So I already writing these frames (1 at a time) to a RAW file via fopen, fwrite, and fclose.

I also want to write to an AVI (1 frame at a time) but the AVIwrite routine in the NI VISION wants an Image Type passed in???   I do create the AVI file but that was a good suggestion. 

So bottom line is how do I take my single frame and convert it to an image type?

thanks,
0 Kudos
Message 5 of 6
(3,747 Views)

Hi,

Sorry if my last post wasn’t very clear, I neglected to mention that to write to an AVI your image needs to be an 8 bit or RGB image.  If your image is any other data type then you will need to convert it to 8 bit or RGB before writing it to an AVI file.  I hope this helps.

Regards,

GG

0 Kudos
Message 6 of 6
(3,722 Views)