1

I was wondering why in OpenCV examples when it comes to meanshift tracking, only Hue channel is used.

In https://docs.opencv.org/4.x/d7/d00/tutorial_meanshift.html such line of code implies what I wrote:

roi_hist = cv.calcHist([hsv_roi],[0],mask,[180],[0,180])

I understand main idea to convert RGB color space to HSV, but I do not get why only selecting Hue is enough. I know that roi_hist is later used to create back projection, but I also know that it is possible to create 2-D roi_hist by selecting also Saturation.

What it depends on? Should I expected that adding Saturation will improve my tracking results? I want to perform face tracking so I am looking for skin color.

Thanks in advance for help.

Filip
  • 11
  • 2
  • 2
    Have you tried using the saturation channel? Before arriving at a conclusion ts better to experiment various possibilities – Jeru Luke May 28 '22 at 17:57
  • `cv::calcHist` is an incredibly weird function, very non-orthogonal, with byzantine parameters. I find it impossible to make sense of. -- don't worry too much about specifics. someone wrote that tutorial a long long time ago, presented what works, and that's it. you shouldn't expect it to make much sense. if you have an intuition, follow it. it's likely better than the tutorial. – Christoph Rackwitz May 29 '22 at 08:22

1 Answers1

1

The OpenCV tutorial you linked references the paper that introduces CAMSHIFT. The CAMSHIFT algorithm was designed to track human faces. On page three, the paper states:

Except for albinos, humans are all the same color (hue). Dark- skinned people simply have greater flesh color saturation than light-skinned people, and this is separated out in the HSV color system and ignored in our flesh-tracking color model.

The use of the H in HSV allows for a single channel tracker that works for most human faces.

Juancheeto
  • 556
  • 4
  • 16