After the binary [Link] and gray-level images, the color images represent the last (and the most sophisticated) family of images used in image processing softwares. Colors are obtained by the combination of three primary colors. The latter may be different depending of the device displaying/printing the image.
In ImageJ, the most usual color images are encoded with the RGB color space.
RGB (for Red,Green, Blue) is the most common color space used by computers. It belongs to the additive color space family. That means that you start from the black color and by adding various quantities of red, green, and/or blue, you obtain all the color shades as shown in Fig.1.
Fig;1: RGB color space. The ImageJ script creating this image is at the end of this post. |
ImageJ uses the RGB color space to define a color image. As shown in Fig. 2A, the titlebar of the clown image ( File > Open Samples > Clown (14K) ) contains the mention 'RGB' as image type.
Fig:2: Original RGB image and the three red, green, and blue corresponding channels |
1- How can we observe the three color channels?
The color image can be split into three channels by using the function Image > Colors > Split Channels. Three 8-bit images are created corresponding respectively to the red, green, and blue channels. This means that a color image is a 24-bit image (equal to three channels of 8-bit). This type of RGB is also called RGB-24 or RGB-888.Now, what about the colors? In Fig. 2, for example, the clown's red nose appears as a combination of light gray in the red channel and dark gray in the two others (green and blue) leading to the color red (corresponding roughly to red > 200; green ≈ 0; blue ≈ 0).
2- Gray to RGB conversion: merging channels
The reverse operation is also possible by merging three 8-bit channels to obtain a RGB image using the function Image > Colors > Merge Channels. Fill in the Red, Green, and Blue with the corresponding channels and let the Gray to *None*, uncheck the Create Composite and check Keep source images. Click on the OK button and your color image is back.Of course, if you interchange the channels as shown in Fig. 3, the result leads to a completely different image...
Fig.3: Merge channels to build a color image. A) Dialog Box. B) Resulting image by interchanging the red and blue channels of the clown of Fig. 2. |
Imagine that you want to visualize the location of objects of interest. In Fig. 4, the blobs image (File > Open Samples > Blobs) is thresholded (Fig. 4A) and an Analyze Particles is run to select particles with an area comprised between 0-400. The result is displayed as a mask (Fig. 4B). Finally, the thresholded and masked images are merged as red and green channels, respectively, yielding yellow small blobs among red larger blobs (Fig. 4C) ... a simple and demonstrative way to present your results.
Fig;4: Merging channels to highlight image features. |
3- RGB to Gray conversion
In ImageJ, the function Image > Type > 8-bit (or 16-bit) easily converts a RGB into a gray-level image. But, in many cases, it's better to split the channels and keep the best (most contrasted) channel for further processing (thresholding, for example). This is specially true for multispectral images like fluorescence images where each wavelength is recorded in a separate channel as shown in the sample of Fig. 5.4- Scripts
The script creating the image of Fig.1
+++ IJ snippet ++++++ End of IJ snippet +++
+++ IJ snippet ++++++ End of IJ snippet +++
No comments:
Post a Comment