Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

how to find the address of the first array element

In the NI_ReadWriteAVI.DLL zip file there is the file named CVI_AVI.c which states:"You must make the border 0, or else the written file will be slanted. Another alternative is to copy one image with a border to another image without a border, or use the ImageToArray function and pass the address of the first element to the AVI_Write function instead of getting the pixel pointer of an image without a border.

My question is how do I get the address to the first element of the bitmap array? I have tried property nodes to no avail. Any help would be appreciated.

Thank you,

Rick
rfluck@srv.net
0 Kudos
Message 1 of 4
(3,554 Views)
Rick,

You can optain the address of the first pixel in an image by using IMAQ GetImagePixelPtr.vi. Just input the image and the pixel's coordinate (0,0 for the first pixel in an image with no border) and the pointer is output.

Kyle V
0 Kudos
Message 2 of 4
(3,554 Views)
Kyle,

I knew that. I want to get away from the IMAQ functons and read a .bmp file and feed the pixal array to the avi file. I need to be able to serve the address of the first element of the pixal array to to this, at least according to the CVI_AVI.c file. I was hoping that the author of the file at NI would comment on his statement in the CVI_AVI.c file as to understand how he implimented the Imag to array function. Thanks for the reply any way though.

Rick
0 Kudos
Message 3 of 4
(3,554 Views)
Hey Rick,

There are a couple of different methods for getting the image data into the AVI:
1 - Use an IMAQ image with a border of 0 and pass the pointer to this image using the imaqGetPixelAddress that Kyle described (make sure the border of the IMAQ image is 0 if you use this method).
2 - You can convert the IMAQ image to an array using the imaqImageToArray function and this will avoid any problems with the IMAQ image having a border.
3 - Copy an IMAQ image with a border to IMAQ image Image without a border and pass the pixel pointer of the image without the border.

It sounds like you want to read several BMP files and save them to a AVI file. I would recommend calling IMAQ Vision functions to read BMP files to IMAQ Images with a border of 0 an
d then passing the pixel pointer of the IMAQ Image. If you want lower level functions that don't use Vision, there are CVI Utility functions for reading a bitmap file (GetBitmapFromFile) and getting the data (GetBitmapData), which gives you a pointer that you could pass to the AVI function for writing.

Hope this helps,
Brad Buchanan
0 Kudos
Message 4 of 4
(3,554 Views)