Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

padding imaq image to 512 bytes multiple

Hi,

 

I would like to create IMAQ images that have a size that is a 512 byte multiple. This in order to do efficient unbuffered disk writes. Is there a way to create such images without  copying data?

 

Is there a description of the IMAQ Image file format (I have a description of the pixel data layout from the IMAQ GetImagePixelPtr.vi help, but this doesn't describe the header layout).

 

Thanks a lot,

Dixie

0 Kudos
Message 1 of 5
(4,085 Views)

 


would like to create IMAQ images that have a size that is a 512 byte multiple.

 

I am not getting this line.Do you mean that the image size will be 512 bytes? 

0 Kudos
Message 2 of 5
(4,075 Views)
Sorry for my sloppy writing: what I mean is that unbuffered writes must be done in a multiple of the disk sector size, usually 512 bytes, so the image data structure must be of size N*512 bytes.
0 Kudos
Message 3 of 5
(4,073 Views)

You can determine the memory layout of the IMAQ images by looking into the IMAQ Image "control" but that is subject to change, and I do not know if the "header" changes size as the image size changes.

 

To overcome this issue in our lab, we use the "Image to Array" function to get the pixel data in an i16 array. 

 

We write our own header information (sector aligned) followed by the image data followed by a chunk of "bytes to skip".

 

If the image is sector-aligned, then the number of bytes to skip is zero and all the image data is contiguous. 

If the images are not a multiple of the sector size (4096 bytes in our case) then we write filler data between them.

 

If the "IMAQ Image" typedef changes, it will not affect us because we are only writing the pixel data (not including any other attributes).

 

Hope this helps.

Message 4 of 5
(4,040 Views)

That is of course a solution for writing the data, but it still involves the Image to Array function that has to copy all the pixel data. I would like to avoid the extra overhead of that copy. I think I have the solution now in a reply from Brent R on another thread I started. Thanks for your suggestions.

 

Dixie

0 Kudos
Message 5 of 5
(4,028 Views)