I need to perform hue adjustment functionality on the image. Since it involves Slider functionality in UI the algorithm needs to be faster.
I had already implemented RGB->HSV->H adjust->RGB with fixed point optimization etc., but the speed of the algorithm is still an issue.
I tried the approach mentioned in the below link Shift hue of an RGB Color
--
Color TransformH(
const Color &in, // color to transform
float H
)
{
float U = cos(H*M_PI/180);
float W = sin(H*M_PI/180);
Color ret;
ret.r = (.701*U+.168*W)*in.r
+ (-.587*U+.330*W)*in.g
+ (-.114*U-.497*W)*in.b;
ret.g = (-.299*U-.328*W)*in.r
+ (.413*U+.035*W)*in.g
+ (-.114*U+.292*W)*in.b;
ret.b = (-.3*U+1.25*W)*in.r
+ (-.588*U-1.05*W)*in.g
+ (.886*U-.203*W)*in.b;
return ret;
}
skipped the conversion of RGB<->HSV. The speed has improved but the problem is along with hue, saturation and value is also changing.
I want to maintain same saturation and value of the current pixel but modify only the hue component, how do I achieve it... your help is most appreciated...