LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help needed for scaling 1024x1024 image

Solved!
Go to solution

Hello everyone,

 

 

I've made a VI where I load a BMP-file of 1024x1024. The BMP is generated by another VI who's getting a frame of a videostream of my webcam. The frame image then gets grayscaled for further processing. My final goal is to make a facerecognition in LV.

 

So when I load the grayscaled image I get nothing but if I use the 512x512 version then I am able to scale without any problem. 

I think it a kind of an overflow problem but I am unable to solve it..

 

 

Thanks in advance

0 Kudos
Message 1 of 6
(3,051 Views)

The 512x512 image has a color depth of 8 bits but the 1024x1024 image has a color depth of 24 bits.  You only get 8 bit data from Unflatten Pixmap.vi, which will have no data for a 24 bit image.  You should look at the image depth then use the appropriate output from the VI.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 2 of 6
(3,038 Views)

Thanks for the quick reply.

 

I have no idea how I missed that but unfortunately when I try to scale I get a scaled window but with just a filled blue color?

Of course I could convert it to 8bit and everything would be fine but I just want to know why it didn't solve my problem?

 

 

0 Kudos
Message 3 of 6
(3,029 Views)
Solution
Accepted by topic author Sailiman

24 bit picture data is an ara of U32.  If you change the input to the Initialize Array function to be a U32 instead of a U8 it will work as long as you detect the image depth and use the correct input to Flatten Pixmap.vi.

 

I've attached a version that seems to work.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
Message 4 of 6
(3,011 Views)

Thank you very much for the help!

It's those little details in LV that I still have to grasp.

 

Sincerely yours

0 Kudos
Message 5 of 6
(2,984 Views)

If you look at the way the image data is written you'll understand why you got a blue square.  Even though the array data type is 4 bytes (32 bits, U32) the data is actually 3 bytes (24 bits) for each pixel.  The MSB is the red value, next is the green value, and the LSB is the blue value.  Since you were using an array of U8 LabVIEW coerced all data to U8 which made most, if not all, pixels 255.  Any pixel that had a red or green component ended up solid blue.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 6 of 6
(2,976 Views)