Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OpenCV running slow
- IplImage* DrawHistogram(CvHistogram *hist, float sX)
- {
- float histMax = 0;
- cvGetMinMaxHistValue(hist, 0, &histMax, 0, 0);
- IplImage *imgHist = cvCreateImage(cvSize(256, 64), IPL_DEPTH_8U, 1);
- cvZero(imgHist);
- float histValue = 0;
- float nextValue = 0;
- for (int i = 0; i < ((BINS - 1)*sX); i++)
- {
- histValue = cvQueryHistValue_1D(hist, i);
- nextValue = cvQueryHistValue_1D(hist, i + 1);
- CvPoint p1 = cvPoint(i * sX, 64);
- CvPoint p2 = cvPoint((i + 1) * sX, 64);
- CvPoint p3 = cvPoint((i + 1) * sX, 64 - histValue*(64/histMax));
- CvPoint p4 = cvPoint(i * sX, 64 - histValue*(64/histMax));
- int n = 5;
- CvPoint pts[] = {p1, p2, p3, p4};
- cvFillConvexPoly(imgHist, pts, n, cvScalar(255));
- //cvFillPoly(imgHist, pts, &n, 1,cvScalar(255));
- }
- return imgHist;
- }
Advertisement
Add Comment
Please, Sign In to add comment