Total Pageviews


November 10, 2015

RGB-to-HSI and HSI-to-RGB Conversions

by 4hathacker  |  in Image Processing at  8:54 AM

RGB to HSI conversion is one of the methods for image enhancement. Let us first discuss about RGB and HSI models and then using simple formulas just see how this conversion happens.

We have studied about RGB Color model in one of the posts earlier.Let us revise the RGB once again only the part that is important for HSI conversion.
In the RGB model, an image consists of three independent image planes, one in each of the primary colours: red, green and blue. Specifying a particular colour is by specifying the amount of each of the primary components present. Figure shows the geometry of the RGB colour model for specifying colours using a Cartesian coordinate system. The greyscale spectrum, i.e. those colours made from equal amounts of each primary, lies on the line joining the black and white vertices.

In HSI model, color can be specified by three attributes/quantities namely hue, saturation and intensity. 
Hue is a color attribute which is used to describe a pure form of color (may be pure yellow, red or orange).
Saturation is a measure of degree to which a pure color is diluted by white light.
Intensity is the information of colors in the image.
All in one, we can say that HSI model is in close relation with the color perception of human beings.

Conversion formula:
In the image below, see for the rgb_to_hsi conversion formula and also find hsi_to_rgb conversion formula in the next image.

MATLAB Program:
Now let us create a simple program which asks for an image location (use inverted quotes for location) and then gives us back the converted HSI image. Here I am only giving the program code built into a function for rgb_to_hsi conversion. Try yourself to build a code for hsi_to_rgb conversion of image using the formula given.

function rgb_to_hsi()

x = input('Enter the loaction of RGB Color image: ');
rgb = imread(x);figure;
imshow(rgb);title('RGB image');

%Represent the RGB image in [0 1] range
I = double(rgb)/255;
R = I(:,:,1);
G = I(:,:,2);
B = I(:,:,3);

numi = 1/2*((R-G)+(R+B));
denom = ((R-G).^2+((R-B).*(G-B))).^0.5;

%To avoid divide by zero exception add a small number in the denominator
H = acosd((numi./(denom+0.000001)));

%If B>G then H = 360 - Theta

%Normalise to the range [0 1]
H = H/360;

S = 1- (3./(sum(I,3)+0.000001)).*min(I,[],3);

I = sum(I,3)./3;

HSI = zeros(size(rgb));

figure, imshow(HSI);title('HSI Image');

Thats enough for RGB and HSI. To know more about that just search on google for Munsell Color System. It will get you to deeper concepts and similar algorithms.


  1. With the various software program and purposes that we've as we speak when it come to on-line information, it can be crucial as properly to discover a file format that makes our information simple to handle however not simple to change. If you want to learn more about this topic please visit

  2. i was lost with no hope for my wife was cheating and had always got away with it because i did not know how or always too scared to pin anything on her. with the help a friend IN PERSON OF PAIGE who recommended me to who help hack her phone, email, chat, sms and expose her for a cheater she is. I just want to say a big thank you to HACKINTECHNOLOGY@GMAIL.COM . am sure someone out there is looking for how to solve his relationship problems, you can also contact him for all sorts of hacking job..he is fast and reliable. you could also text +1 669 225 2253

  3. It’s good to take risk sometimes. I’ve realized that people who do great exploits are people who take risk. Nothing good comes or happens easily. You may be battling with your bad credit, negative items and different bills but if care is not taken depression might set in. I want to introduce CREDIT TRINITY CARE to you guys and trust me, he’s gonna help you fix your credit ASAP. He’ll delete all the negatives and boast your credit score. He boasted my credit score from 400 to 790+ within few days. I read about him on credit blog and discovered that he’s not one of those usual names, so I contacted him via I’m forever grateful to CREDIT TRINITY CARE. I wish I can say everything here which is not possible but all I know is that he can be trusted

  4. Hello Friends, My name is Leo Marcos I live Colorado with my family. I'm a Truck driver and am always busy on the road. I want to appreciate TROVIAN CREDIT REPAIR for their monumental help recently on my bad credit I got to tell you this. My score was 510 I wanted to buy a house but I knew my credit was not up to standard to get a home. So I made a personal research along which i came across a review about TROVIAN on how they fixed a Man's credit and increased his score so I contacted them immediately they deleted my old accounts and increased my score to 803 which i was so surprised now I’m able to buy a house. I really appreciate their good work and i promised about telling everyone out there what they did on my report. They are very good and understanding expert you can easily reach them on TROVIANCREDITREPAIR@GMAIL.COM +1 (424) 307 4562

  5. Few years ago, I had been dating a guy who I thought was very responsible. One day his truck broke down, and he didn’t have the money to fix it. So I decided to co-sign on a Midas credit card with him, as he couldn’t get it himself. He broke up with me a month later, and as much as I thought he would do the responsible thing, all of a sudden my score started dropping. He hadn’t paid anything on the card over 8 months. I called the company to closed the card from further charges, before he would ruined my life and that of my credit score more than what he has done I was so confused because I could not use my card all I was doing was paying debt not until I came in contact with TROVIANCREDITREPAIR@GMAIL.COM CALL +1 (424) 307 4562 they helped me cleared all the debts on my card and raised my score to a high 800, thanks for lifting me back to life.

  6. Most times when i see people complain of what they go through due to their bad credit profile I will sit back and give thanks to TROVIAN, have been going through a bad report those days and I totally understood how bad the situations was and on bearable for me to get my own apartment and bank also denied me access on getting a credit card, my best wasn’t working until i came across TROVIAN CREDIT REPAIR and he helped me erase all the bad items he also helped me get a credit card have been aspiring for a long time also raise my score to 810. Now am in my own apartment am so happy. You can reach him if you want to fix your credit report through his email TROVIANCREDITREPAIR@GMAIL.COM TEXT +1(424) 307 4562

  7. Words can’t just express how excited I am right now , KNIGHTHOODBOT@GMAIL.COM is indeed a lifesaver.. I nearly Lost all my Crypto to fake investment platform in 2020 , it all started when a colleague of mine introduced me to the platform that she has been earning from during the pandemic and I thought I should give it a try also since she has been earning from their for quite sometime now but that was one of my biggest mistake , I ended up investing a total of 262k in USDT and waited for my profit which appeared on my portfolio on the website but cannot withdraw , that was frustrating and left me with no option but to hire a hacker after 2 months of waiting for the feds to help but nothing came out of their investigation , I don’t really know what I could have done if I hadn’t came across KNIGHTHOODBOT At GMAIL DOT COM . I can assure you that he is indeed the best recovery hacker out there .

  8. I can actually say that there is no better credit repair hacker out there than CLASSICREPAIR4U@GMAIL.COM , I knew this after he took down 13 inquiries and a total debt of 320k that I had on my credit report , this has been bothering me for a very long time , I nearly gave up along the line while trying to get it fixed but I believed that there’d be light at the end of the tunnel ,so I kept my hopes high, I’d really say that I was fortunate enough to know about classicrepair team ‘cause I don’t know what my situation would have been by now if not for the team , So folks make the right choice today and contact the team just like I did . I’m glad to share this with you guys .

  9. We invested 204 ETH in order to receive an extra 45% return on our investment. We consulted a business that had experience in getting people the up-to-date information they needed to make the best investment decisions. They helped us by telling us how to get into the Alcohol Industry in Canada and what would be the best equipment to use to start distilling. We are happy with the 45% ROI we received and would write a new big contract with them if we were to invest again.

  10. The best thing that happened to me this new year is coming across an article about Wardrivers cyber, a professional hacker and private investigator. I had invested $67,000 into a cryptocurrency platform that turned out to be a scam and I had no idea how to get back my money until I contacted Wardrivers cyber, they were able to recover everything from these scammers without breaking a sweat. I’m truly grateful and I’m sharing this out there with everyone. You might have been involved in a romance scam, or fake cryptocurrency investment, and you wish to get back your money, then you need to contact Wardrivers cyber too. Don’t let anyone get away with your hard-earned money. This is their email address: ( Wardriverscyberservice@techie. com )

  11. It's been a crazy year for me, unfortunate happenings beyond me made score fall to 622, I needed a loan few months ago for my failing business which could'nt be approved because of my credit score. A colleague linked me up with Clever Hacker, after contacting him he didn't just raise my score to a golden and remove my eviction. Thanks to him I got my loan approved contact cleverhacker |.| hack |@| gmail |.| com


Like Our Facebook Page

Nitin Sharma's DEV Profile
Proudly Designed by 4hathacker.