8

I have written the code for histogram and i want to use it for SVM traning. But the fundamental problem is that i don't understand how many minimum number of bins i should choose so that i can get widely varied distribution among bins for different colors (red,green,yellow,blue,orange).

So, can somebody give me the link/post the image of Hue color wheel for openCV. I need something as shown below but the hue range in it is 0-360 and i need a color wheel used by opencv (i.e. 0-180 )

image

Community
  • 1
  • 1
skm
  • 5,015
  • 8
  • 43
  • 104
  • I literally googled "Hue color wheel for openCV" and got http://www.shervinemami.info/colorConversion.html as my first result. Will this help you? – Dyrborg Feb 12 '14 at 19:39
  • thanks, it might be somehow helpful but i need an image for better visualization and planning. – skm Feb 12 '14 at 19:48

1 Answers1

5

in opencv, the hsv image has to fit into 3 8-bit channels, (no problem for S and V [0..255]) .

since H is in the [0..360] range, the actual values get divided by 2, so it fits into a uchar.

just divide any value in the diagram above by 2. ( or multiply the value you get from opencv )

berak
  • 39,159
  • 9
  • 91
  • 89
  • i am not sure if it will work or not. I would prefer to have an image which can be trusted as this histogram is giving me too much trouble even in finding the simple colors. – skm Feb 12 '14 at 19:54
  • hey, i'm talking only about the *range* , not perceptual problems – berak Feb 12 '14 at 20:00
  • yeah, i just meant that dividing the range by 2 is a trustable method. For example, in the image given above the range of yellow is from 45-75 so, in opencv the range would be 22.5-37.5. Doing so will be ok? – skm Feb 12 '14 at 20:07
  • For clarification: `H` ranges from 0 to 360 if you feed cvtColor a frame with float32 values to convert to HSV but the same HSV conversion call yields `H/2` (which ranges from 0 to 180) in place of `H` if you feed cvtColor a frame with uint8 values. – Paul Feb 04 '23 at 00:07