我正在根据如下图像创建 HSV 直方图。
- (void)processImageWithHsv:(Mat&)image;
{
Mat image_hsv;
cvtColor(image, image_hsv, CV_BGR2HSV);
int hbins = 50, sbins = 60;
int histSize[] = {hbins, sbins};
float hranges[] = { 0, 360 };
float sranges[] = { 0, 256 };
const float* ranges[] = { hranges, sranges };
MatND hist;
int channels[] = {0, 1};
calcHist( &image_hsv, 1, channels, Mat(), // do not use mask
hist, 2, histSize, ranges,
true, // the histogram is uniform
false );
double maxVal = 0;
minMaxLoc(hist, 0, &maxVal, 0, 0);
// ???: HOW Convert this information to colour value
}
但我不知道从中获得最主要的颜色值hist
?
我应该使用maxVal
?