this question is regarding opencv with c++ in VS2008 express.
I'm doing very simple thing. Trying to get skin values from camera image.
As you can see in the screenshot camera image looks fairly good. I'm converting it to HSV & separating Hue channel from that to later threshold the skin value. But Hue channel seems too much noisy & grainy. Also HSV image window shows degradation of information. Why is that happening? & how to solve that. If we cant can we remove noise by some kind of smoothing? Code is as below :
cv::VideoCapture cap(0); // open the default camera
cv::Mat hsv, bgr, skin;//make image & skin container
cap >> bgr;
cv::cvtColor(bgr, hsv, CV_BGR2HSV);
hue = channels;
cvWaitKey(0);//wait for key press
Hue channel seems too much noisy & grainy. Why is that happening?
In the real-world colors we see, the amount of information represented by "hue" varies. The color red is completely described by hue. Black has no hue at all.
However, when a color is represented in HSV as you have done, the hue is always one-third of the color information.
So as colors approach any shade of gray, the hue component will be artificially inflated. That's the graininess you're seeing. The closer to gray, the more hue must be amplified, including error in captured hue.
Also HSV image window shows degradation of information. Why is that happening?
There will be rounding errors in the conversion, but it's probably not as much as you think. Try converting your HSV image back to BGR to see how much degradation actually happened.
& how to solve that.
Realistically, you have two options.
Use a higher-quality camera, or don't use HSV format.