Hi, im making a program that can convert RGB to HSI. Hue, Saturation and Intensity.
Im using OpenCV for doing it. But i however cant used the premade funcs in opencv.

Im loading my input image into a matrix, and im dragging out the rgb-info for each pixel and converting them to HSI values. And this is gonna run in a loop for x and y to process through the whole image.

The RGB image is displayed by 3 values per pixel in the range of 0-255. if a value exceeds 255, it will start from 0 again. Meaning if u by some reason get a value of 300 into a pixel's color channel, then it will display as 45 instead.

The HSI color space works with 3 different brackets, 1 for each channel.
H is 0-360
S is 0-1
I is 255

"H"and "I" works with whole numbers, but "S" works with 0.3 etc.

The output i should get from this would be 3 windows with 3 images, displaying the value of H,S,I. But i cant figure out how to get the 0-360 value working.

So question is more or less if there is some "smart" way of doing it, or if it have to be divided by 255, so that it would be relative colors shown in RGB, but representing their equivalent HSI value.