#include #include #include #include #include "cvcam.h" #include "cv.h" #include "highgui.h" /************************************************************************ * ************************************************************************/ int main( int argc, char** argv ) { IplImage* frame, *frame_copy = 0; IplImage *imgB,*imgG,*imgR,*imgA; uchar *data; CvScalar mBGR, dBGR; double mR,mG,mB; double dR,dG,dB; int i,j,k; if( argc == 2 && (frame=cvLoadImage(argv[1], 1))!= 0) { if( !frame ) exit(0); } cvNamedWindow( "result", 1 ); // Exibe região com a cor segmentada cvShowImage("result", frame ); mBGR = cvAvg(frame,0); mB=mBGR.val[0]; mG=mBGR.val[1]; mR=mBGR.val[2]; cvAvgSdv(frame, &mBGR, &dBGR, 0); dB=dBGR.val[0]; dG=dBGR.val[1]; dR=dBGR.val[2]; // cvWaitKey(0); printf ("Mean R,G,B: %.2lf - %.2lf - %.2lf\n",mR,mG,mB); printf ("StdDev R,G,B: %.2lf - %.2lf - %.2lf\n",dR,dG,dB); cvWaitKey(0); cvReleaseImage( &frame_copy ); cvDestroyWindow("result"); return 0; }