Skip to content
Related Articles
Open in App
Not now

Related Articles

How to Convert HSI Image to RGB Image in MATLAB?

Improve Article
Save Article
Like Article
  • Difficulty Level : Medium
  • Last Updated : 11 Jan, 2023
Improve Article
Save Article
Like Article

HSI stands for Hue Saturation Intensity. HSI is color space, it provides a way of numeric to readout the image that is corresponding to the color name contained. RGB it’s basically called the RGB triplet. in MATLAB the RGB image is a kind of  MxNx3 M cross N cross 3 arrays of colors pixel which is use three columns wide and each row contains three elements RGB (red, green, blue) triplet

In MATLAB image conversion is mostly performed operation in digital image processing. converting the color spaces of images the mostly used to analyze a subcategory or field of digital signal processing. MATLAB can not perform the direct HSI image conversion to RGB image, because MATLAB does not have any pre-built-in function for performing the HSI image conversion to RGB image. conversion of HSI to RGB image kind of matrix-based Mathematical equation problem.

So in this article, we will learn how to convert the HSI image to an RGB image in MATLAB following the line of code. First of all, you have to open your MATLAB editor and then create a new script for performing Conversion to RGB image color mode.

Example 1:


%  MATLAB program for conversion HSI to RGB image.
figure, % show the HSI image in figure1.
imshow(HSI);title('HSI Image'); 
 % Get the Hue, Saturation and Intensity components 
 % Multiply h1 Hue with the range [0 360] 
 % allocation of the r,g,b element.
 R1=zeros(size(H1));  % return an matrix values.
 %RG Sector(0<=H<120) 
 %Subtract 120 from H1 
 %Subtract 240 from Hue 
 %Form RGB Image 
 % Present image in the range [0 255] 
 figure, % show the image in the figure 2
 imshow(RGB1);title('RGB Image');

Output 1:

figure1 HSI image

Output 2:

figure2 – RGB image


So in the above code firstly we show the HSI image in a figure which is in form of different colors means it is in Hue, Saturation Intensity values. then we obtain the HSI component, then multiply it with hue within the range 0 to 360. after that, we will allocate the RGB triplet with zeros. 

After running the above code you will get two figures as output first is the HSI image as figure1, and then that HSI image will convert into an RGB image which shows in figure2.

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!