Q: How can I retrieve the hue, saturation, and intensity values of a pixel?
A: If you want to know the hue, saturation or intensity of a pixel, you can easily retrieve them by using the BiImage.dll. There are many color conversion functions to convert an RGB pixel to other color spaces including converting RGB to HSI. If you have a device independent bitmap, you can get the RGB color of a pixel with GetDIBPixelColor function of the BiDib.dll and then extract the HIS information as demonstrated below.
Code example:
#include “BiDib.h”
#include “BiImage.h”
…
COLORREF col;
If (GetPixelColor(hDib, 10, 50, &col))
{// retrieve color of the pixel in 10, 50 position
S_HSI his;
S_RGB rgb;
rgb.red = GetRValue(col);
rgb.blue = GetBValue(col);
rgb.green = GetGValue(col);
his = RGBToHSI(&rgb);
}