LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

32-RGB Conversion to 1-bit

Hey there!

 

I want to convert an 32-RGB image to a simple 1-bit image, meaning it has a colour depth of 1-bit. I tried the following:

Capture.PNGThis was the simplest solution I could come up with. And yet it only shows me completely white images, regardless of its input. What goes wrong? And how can I solve it?

0 Kudos
Message 1 of 6
(4,372 Views)

look inside the UnflattenPixmap function to understand what's going on.

And then you need to analyze the "24bit pixmap" data and convert them to b/w image (based on the assumption you load a 24bit color JPG image)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(4,364 Views)

I looked inside the VI's, but they are kinda complicated (The 24-bit data returns ' FEFE', and I don't know what that means). Could you give an example as to how I could do convert it?

0 Kudos
Message 3 of 6
(4,359 Views)

I miss a threshold, at what level(s) of the RGB pixel value(s) do you want to set a 1 or a 0?

and if you read the help for the unflatten Pixmap vi you will find that the data is just unflatten to ONE of the output arrays (the one that fit to the pic data) you have to reduce it by your own.

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 4 of 6
(4,358 Views)

I played 🙂

picmanipulation.png

picmanipulationBD.png

 

the sliders on the left (org) pic move both with a sledge hammer method (timeout and properties), how would a nice event driven solution look like?

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 5 of 6
(4,344 Views)

I played too.

 

I like the array-based RGB deconstruction.  I've always hated going pixel-by-pixel through an image in order to use "color to RGB.vi".   Has anybody every put "make color to RGB accept 2D inputs" on the idea exchange...I'll have to check. 

 

I moved the deconstruction outside the loop so it's only done once and I added RGB weighting per human perception. The thresholding value will now be a number between 0 (black) and 255 (white).

 

There are coersion dots all over, but what's a little coersion between friends?

Message 6 of 6
(4,309 Views)