赞
踩
统计比较图像亮度
- int main()
- {
- IplImage* imgA = cvLoadImage ("E:\\vcprojects\\opencv\\a.bmp", CV_LOAD_IMAGE_GRAYSCALE);
- IplImage* imgB = cvLoadImage ("E:\\vcprojects\\opencv\\b.bmp", CV_LOAD_IMAGE_GRAYSCALE);
-
- cvNamedWindow ("a", CV_WINDOW_AUTOSIZE);
- cvNamedWindow ("b", CV_WINDOW_AUTOSIZE);
- cvShowImage ("a", imgA);
- cvShowImage ("b", imgB);
-
- CvScalar scalarA = cvAvg(imgA);
- CvScalar scalarB = cvAvg(imgB); printf ("avg A:%f avg B:%f\n", scalarA.val[0], scalarB.val[0]);
-
- cvWaitKey(0);
-
- cvReleaseImage (&imgA);
- cvReleaseImage (&imgB);
- cvDestroyWindow ("a");
- cvDestroyWindow ("b");
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。