From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert picture to grayscale

Hi,
I have made this program... and i can't seem to make the image grayscale. I thought the using the 8-bit output would do it, but it doesn't.
anyone know how to make my picture grayscale?
Thanks
aleks.
0 Kudos
Message 1 of 4
(2,545 Views)
You can take the 24bit image and average the RBG components for each pixel. If you want 8bit, you need to create a greyscale color table (R=G=B).
0 Kudos
Message 2 of 4
(2,543 Views)

I tried doing that, but the 8bit output on the unflatten pixmap VI is already just a 2D array of numbers, and that's the signal that i'm using.

(I deleted the 4-bit and 24-bit pixmap outputs in my original program and everything works)

 

Attached is a sample image that im working with.

Anythought?

0 Kudos
Message 3 of 4
(2,538 Views)


@labuda wrote:
I tried doing that, but the 8bit output on the unflatten pixmap VI is already just a 2D array of numbers, and that's the signal that i'm using.
For an 8bit paletted image, each array element is just an index into a color table, which you have wired seperately. You simply need to convert the color table to gryscale by averaging the RGB components of the 256 colors before further processing.
0 Kudos
Message 4 of 4
(2,531 Views)