LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save a pixel array into a Tiff file

I use a camera to acquire an image and plot it in the canvas. During this process, I could have a pixel array and I want to save it into a TIFF file. But, I can't find any function to achieve this goal in the IMAQ Vision library. Does there have any way to save an pixel array into a file??
Thank you!!
0 Kudos
Message 1 of 6
(4,220 Views)
The 'IMAQ ArraytoImage.vi' will accomplish this task along with the 'IMAQ Write TIFF File.vi'. However, these are only available if you have the IMAQ Vision Development Module installed (not just NI-IMAQ). If you only have NI-IMAQ, then you could try using the 'Flatten Pixmap.vi' and the 'Write BMP File.vi' functions that are in the Graphics and Sound palette (there is no TIFF option amongst the graphics vi's).

I hope that gives you some ideas and gets you going. Good luck with your project!
0 Kudos
Message 2 of 6
(4,203 Views)
Hi Marc,
Thanks a lot. But in the NI VISION library, there are two functions as you mentioned. My problem is that I don't use the IMAQ Card to connect to my camera and I just use the DAQ card from the camera manufacturer. Therefore, I can't use some functions, ex: imginterfaceopen, imgsessionopen and etc. This limitation forces me to find out another solution to acquire image and to plot the image under the Labwindows developer environment. Under this situation, do you suggest me a better way to do what I want to do?? Thank you!
0 Kudos
Message 3 of 6
(4,180 Views)
The Vision functions do not require you to have National Instruments image acquisition hardware (most of the NI-IMAQ functions do - as you noted with the imgsessionopen). Vision functions can be performed on any imported image once it is converted to the Image Data Type. If you are able to get your 3rd party image acquisition board to output an array of pixel values, you would be able to convert this into the Image Data Type using the Array to Image . . . and then perform any of the Vision functions you need (such as saving to TIFF file).

Note: do not confuse the NI-IMAQ driver and the Vision Development Module - they are different pieces of software. You will have a small version of the Vision dll in LabWindows in you only have NI-IMAQ installed, but it will only have a limited number of functions. If you have the Vision Development Module installed, many more Vision functions are available in the Vision dll - like array to image and save to TIFF.
0 Kudos
Message 4 of 6
(4,171 Views)
Hi Marc,

Thank you again!! I have tried your method, but the error message I got:
NON-FATAL RUN-TIME ERROR: "Test_ArrayToImage.c", line 27, col 1, thread id 0x00000A48: Function imaqArrayToImage: (errorCode == -1074396120 [0xbff60428]). Not an image.

This message bothers me for couple days, and I actually don't know how to solve this problem because I just start to learn C programing. In other words, I can't use the function, imaqArrayToImage, to let my pixel array into the image. Thank you for your response!!
0 Kudos
Message 5 of 6
(4,173 Views)
Try some of the examples on National Instruments website. The following link has a few Image to Array examples that might give you some ideas as to why you are getting that error. You can further search for examples in the Developer Zone section of www.ni.com

Good luck with your project!
0 Kudos
Message 6 of 6
(4,157 Views)