Hi guys... This question might be marked as noob question.. I have been struggling with this problem.. I manages to calculate Histogram of a picture, but cannot show/display it ... How do i do that..
This is How i calculated it
void track(Rect face ){ Mat video,deepRoiExplorer; SparseMat hist_base; VideoCapture cam(0); int h_bins = 50; //int s_bins = 32; //int v_bins = 10;
int histSize[] = {h_bins};
float h_ranges[] = { 0, 180 };
//float s_ranges[] = { 0, 256 };
//float v_ranges[] = { 0, 256 };
const float* ranges[] = { h_ranges};
int channels[] = { 0};
if (cam.read(video)) {
cvtColor(video, video, CV_BGR2HSV_FULL);
Mat ROI(video,face);
flip(ROI, ROI, 1);
deepRoiExplorer =ROI.clone();
calcHist( &ROI, 1, channels, Mat(), hist_base, 1, histSize, ranges, true, false);
int scale = 10;
Mat histImg = Mat::zeros(h_bins*scale,h_bins*10, CV_8UC3);
}
while (cam.read(video)) {
rectangle(video, face, CV_RGB(128,128,128));
flip(video,video, 1);
imshow("video", video);
imshow("ROI", deepRoiExplorer);
}
}