Dr. Cho’s Website
Course Materials

RGB-to-HSI/HSI-to-RGB conversions

Dr. Huidae Cho
Institute for Environmental and Spatial Analysis
University of North Georgia

1   RGB-to-HSI/HSI-to-RGB conversions

\begin{align*} I&=\frac{R+G+B}{3}\\ H&=\begin{cases} \theta&\text{ if }G\geq B\\ 360^\circ-\theta&\text{ otherwise} \end{cases}\\ \theta&=\cos^{-1}\left\{\frac{\frac{1}{2}\left[(R-G)+(R-B)\right]}{\left[(R-G)^2+(R-B)(G-B)\right]^{1/2}}\right\}\\ S&=1-\frac{\min(R,G,B)}{I} \end{align*}

For $120^\circ\leq H<240^\circ$, \begin{align*} H&=H-120^\circ\\ R&=I(1-S)\\ G&=I\left[1+\frac{S\cos H}{\cos(60^\circ-H)}\right]\\ B&=3I-(R+G) \end{align*}

For $0^\circ\leq H<120^\circ$, \begin{align*} B&=I(1-S)\\ R&=I\left[1+\frac{S\cos H}{\cos(60^\circ-H)}\right]\\ G&=3I-(R+B) \end{align*}

For $240^\circ\leq H<360^\circ$, \begin{align*} H&=H-240^\circ\\ G&=I(1-S)\\ B&=I\left[1+\frac{S\cos H}{\cos(60^\circ-H)}\right]\\ R&=3I-(G+B) \end{align*}