Ask Your Question
2

Calculate HSV histogram of a coloured image is it different from H-S histogram?

asked 2013-11-15 07:38:51 -0600

zulfiqar gravatar image

updated 2013-11-15 12:35:23 -0600

berak gravatar image

I want to calculate HSV histogram of a image . In opencv online guide i found H-S histogram . what effect has V on illumination? Are HSV and H-S are same (means to say V has no effect on illumination)?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-11-17 19:41:24 -0600

zulfiqar gravatar image

code to compute HSV histogarm .

 cvtColor( Frame, hsv_base, CV_BGR2HSV );
 int h_bins = 50; 
 int s_bins = 32;
 int v_bins = 10;
 int histSize[] = { h_bins, s_bins, v_bins };
 float h_ranges[] = { 0, 256 };
 float s_ranges[] = { 0, 180 };
 float v_ranges[] = { 0, 256 };
 const float* ranges[] = { h_ranges, s_ranges, v_ranges };
 int channels[] = { 0, 1, 2};
 calcHist( &hsv_base, 1, channels, Mat(), hist_base, 3, histSize, ranges, true, false);
edit flag offensive delete link more

Comments

You should exchange h_ranges and s_ranges values. Hue has the max of 180.

poteko gravatar imagepoteko ( 2019-07-23 09:41:24 -0600 )edit

Question Tools

Stats

Asked: 2013-11-15 07:38:51 -0600

Seen: 2,468 times

Last updated: Nov 17 '13