Convert from RGB to HSV
MT
FwStatus | fwiRGBToHSV_8u_C3R | ( | const Fw8u * pSrc, int srcStep, Fw8u * pDst, int dstStep, FwiSize roiSize ); | |
FwStatus | fwiRGBToHSV_8u_AC4R | ( | const Fw8u * pSrc, int srcStep, Fw8u * pDst, int dstStep, FwiSize roiSize ); | |
FwStatus | fwiRGBToHSV_16u_C3R | ( | const Fw16u * pSrc, int srcStep, Fw16u * pDst, int dstStep, FwiSize roiSize ); | |
FwStatus | fwiRGBToHSV_16u_AC4R | ( | const Fw16u * pSrc, int srcStep, Fw16u * pDst, int dstStep, FwiSize roiSize ); |
dstStep | Destination buffer step size (width of the buffer in bytes). | |
pDst | Pointer to a location in a destination buffer. | |
pSrc | Pointer to a location in a source buffer. | |
roiSize | Specifies the height and width of an ROI. | |
srcStep | Source buffer step size (width of the buffer in bytes). |
These functions step through an ROI in a source buffer, convert the source data from the RGB color model to the HSV color space, and write the converted data to a destination buffer.
A gamma-corrected RGB image (pSrc) declared in the ROI is converted to an HSV image (pDst) as follows.
Value: V = max(R, G, B) Saturation: temp = min = (R, G, B) if (V == 0) achromatics case S = 0 else chromatics case S = (V-temp)/V Hue: Cr = (V - R) / (V - temp) Cg = (V - G) / (V - temp) Cb = (V - B) / (V - temp) if (R==V) H = Cb - Cg if (G==V) H = 2 + Cr - Cb if (B==V) H = 4 + Cg - Cr H = H * 60 if (H < 0) H = H + 360 The formulas assume R, G, and B values are in the range [0 to 1]. For integer data types, the computed image data are scaled to the full range of the destination data type.