Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting file header size and image size

Hi all,

 

Now that the AVI file type won't work for me, I have to do some of that functionality myself.

 

I can use the function to Get File Size, and the size is returned in bytes, so far so good.

 

I figured I could calculate the image size by taking the resolution, multiply X and Y, that gives me the number of pixels.

Then multiply pixels by bit depth, to get the number of bits, divide by 8 for the number of bytes.

Since bit depth is 8, the number of bytes will be exact (and the same as the number of pixels).

 

When I did the math, and divided by the file size, it didn't come to a round number, and was a larger number than the number of images I could display.

 

I figured there is probably additional information stored with each image, but I don't know how to adjust for that.

There may be byte clustering happening, making each image larger than the actual byte count would indicate.

And, there is probably file header info, but not sure where to get that.

 

I looked through the IMAQ functions, and didn't see one about getting the image size (I did see the one that returns resolution, but I have that data already).

 

Any suggestions on how I can calculate how many images are in my binary file?

And, how to get the byte sizes I need to be able to set the file pointer correctly to get an image out of the middle of the file?

 

Thank you for any suggestions,

Jeff

 

 

 

0 Kudos
Message 1 of 2
(4,038 Views)

If I understand correctly You have binary file with multiple images inside and You want to extract that images?

 

Depending on image type You can search by tags where image begins and ends: http://www.impulseadventure.com/photo/jpeg-decoder.html and extract.

 

0 Kudos
Message 2 of 2
(4,026 Views)