Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Keyence IV4 raw binary 24 bit BMP to saveable/displayable picture

hi folks,

I have a Keyence IV4 camera which can take a picture do some vision and then either save it to an internal SD card or it can transfer the data of the picture over TCP/IP. I am trying to do the second onebut all it tells me about the picture data is "Binary data will be in 24-bit bitmap format (regardless of whether the image is color or monochrome)". that said my goal is to take this raw data and convert it into something I can actually use. this is a screengrab of the manual telling us expected response:

Dyencman_0-1736784733800.png

i do this like so:

Dyencman_2-1736785183713.png

this is my result in my string probe:

Dyencman_1-1736784838060.png

I've seen some similar posts and I've tried several things like using flatten/unflatten pixmap but i dont seem to be able to get the data into a format any of the image VI's like, although I may have done so incorrectly. if someone could walk me through the process of converting the data to the right format and getting it to spit out a real picture that would be fantastic

 

0 Kudos
Message 1 of 2
(182 Views)

Here is a guess, but it might get you closer.

 

The number 3,686,454 seems to indicate the number of characters in the image string.  We know 3 characters = 24 bits = 1 pixel, so if we divide the number of characters by 3 we get 1,228,818 pixels.  I will assume the image is 1280 x 960 pixels = 1,228,800 with 18 pixels left over?

 

I would start by using crude methods, then figure out a cleaner way to do it.  I would loop through the image string 3 characters at a time and convert the three characters to U32.  You could use string to U8 array and reshape the array to 3 x 1,228,800, then loop and convert each 3 char array to U32.  Resize the resulting array to 1280 x 960, then try displaying it using an intensity graph.  If it looks like your image, you are on the right track.  If not, try swapping rows and columns or other things until you get it right.  Once you know how to convert it, you can clean it up and make it more efficient and faster.

 

If it is a color image, you would need to convert each triplet to RGB pixels instead of U32.  I would need more information about the image to do much more.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 2
(161 Views)