Recently I generated images in HSV format with S-channel = 255.
I discovered that converting HSV to BGR and back again:
cv::Scalar tempVal = mean (visualizeFrame);
cout << tempVal.val[0] << "; " << tempVal.val[1] << "; " << tempVal.val[2];
// At this point S channel == 255 alright
cvtColor (visualizeFrame, visualizeFrame, COLOR_HSV2BGR);
cvtColor (visualizeFrame, visualizeFrame, COLOR_BGR2HSV);
tempVal = mean (visualizeFrame);
cout << tempVal.val[0] << "; " << tempVal.val[1] << "; " << tempVal.val[2];
// At this point S channel is about 240 in average for a frame,
// the range for many frames is between abt. 220 and 250.
… changes the channel values to an unexpected extend.
I get problems with my further processing having to handle such large tolerances.
However it’s hard to believe that the conversion formulas should
produce as big rounding errors…
Either I have a wrong understanding, or there is a bug in the formula.
Can someone tell?