LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert a grayscale image to 8-bit 2D unsigned integer array

Solved!
Go to solution

Hi.

 

The "Color Utilities" function in Vision Development Modulde contains the IMAQ ColorImageToArray, which only has 32-bit unsigned integer values as an output. Is there an option to achieve an 8-bit unsigned integer value in the output ?.

Best regards

Oesen
0 Kudos
Message 1 of 11
(5,207 Views)

I would use IMAQ Cast Image

Here you can see what it does.  I would cast to U8.

0 Kudos
Message 2 of 11
(5,200 Views)
In your topic subject, you mentioned grayscale to 8bit!! Grayscale images are 8bit.
-You can try converting color(32 bit) to grayscale(8bit) using type cast as GuenterMueller suggested.
-You can also get single color plane (8bit) by simply using IMAQ Extract single color plane also.
Thanks
uday
0 Kudos
Message 3 of 11
(5,185 Views)

Thanks for the reply GuenterMueller

 

I'm already using this function to convert a 32-bit image to 8-bit image, but the problems is the next step. I need to convert the 8-bit image to 2D array of 8-bit unsigned integers.

Best regards

Oesen
0 Kudos
Message 4 of 11
(5,184 Views)

I need this function, but as a U8 output instead of U32

 

Untitled.png

Best regards

Oesen
0 Kudos
Message 5 of 11
(5,175 Views)

First convert your color image to gray scale by one of earlier methods and then Use IMAQ image to array

Thanks
uday
0 Kudos
Message 6 of 11
(5,174 Views)

@Oesen wrote:

I need this function, but as a U8 output instead of U32

 

Untitled.png


Hi Oesen.  Use IMAQ Extract.

0 Kudos
Message 7 of 11
(5,168 Views)

Hi GuenterMueller

 

That function configures the image. My image is converted from 32-bit RGB to a 8-bit Grayscale as shown in the picture below. I just have to configure the data type of the 2D output array from a 32-bit to a 8 bit.

 

Untitled.png

Best regards

Oesen
0 Kudos
Message 8 of 11
(5,150 Views)

As uday said above, use image to array after you have extracted the red color channel.

0 Kudos
Message 9 of 11
(5,142 Views)
Solution
Accepted by topic author Oesen

Please check this. what you have done is not correct(according to me).

-Please use proper wordings for image types

Color-32bit

Gray-8bit

-Intype casting you are using conversion to RGB(U32), Image type should be grayscale there according to your requirement. If the image is color why do you need to typecast again it to RGB??

-After extracting color plane, it is no more color(32bit) image.There is no point in using color image to array. use IMAQ image to array instead.

Thanks
uday
Message 10 of 11
(5,130 Views)