How Do I Convert a Color Image to Grayscale?

Updated Mar 28, 2023



  • LabVIEW
  • Vision Development Module



I am using the Vision Development Module in LabVIEW. How do I convert a color image to a grayscale image?

LabVIEW stores color image data in an array of unsigned 32 bit integers (U32). These color images can be in a Red Green Blue (RGB) or Hue Saturation Luminance (HSL) format. You will need to convert the color image to the HSL format and then extract the luminance plane. The luminance plane corresponds exactly to the grayscale image and furthermore, it is the only color plane that will give an accurate representation of the grayscale image. How to extract color planes and grayscale images using LabVIEW and VDM  and IMAQ: Color Image to Grayscale  are community examples with reusable code to demonstrate this concept.