From b1a3f3b024f3a527d2b83acd259c0be0f4bbe714 Mon Sep 17 00:00:00 2001 From: mdim Date: Mon, 31 Aug 2009 13:52:39 +0000 Subject: [PATCH] fixed warnings git-svn-id: https://code.ros.org/svn/opencv/trunk@2062 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08 --- opencv/samples/c/facedetect.cpp | 35 ++++++------------------------- opencv/src/cv/cvcascadedetect.cpp | 2 -- 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/opencv/samples/c/facedetect.cpp b/opencv/samples/c/facedetect.cpp index 2c7ca05f..d96b5a94 100644 --- a/opencv/samples/c/facedetect.cpp +++ b/opencv/samples/c/facedetect.cpp @@ -3,7 +3,7 @@ #include "cv.h" #include "highgui.h" -#include +#include #include #ifdef _EiC @@ -22,11 +22,6 @@ String cascadeName = String nestedCascadeName = "../../data/haarcascades/haarcascade_eye_tree_eyeglasses.xml"; -const String dirname = "D:/Dimashova/argus/res"; - -double timeSum; -int mcount; - int main( int argc, const char** argv ) { CvCapture* capture = 0; @@ -42,9 +37,6 @@ int main( int argc, const char** argv ) CascadeClassifier cascade, nestedCascade; double scale = 1; - timeSum = 0; - mcount = 0; - for( int i = 1; i < argc; i++ ) { if( cascadeOpt.compare( 0, cascadeOptLen, argv[i], cascadeOptLen ) == 0 ) @@ -79,8 +71,8 @@ int main( int argc, const char** argv ) return -1; } - if( !inputName.size() || (isdigit(inputName.c_str()[0]) && inputName.c_str()[1] == '\0') ) - capture = cvCaptureFromCAM( !inputName.size() ? 0 : inputName.c_str()[0] - '0' ); + if( inputName.empty() || (isdigit(inputName.c_str()[0]) && inputName.c_str()[1] == '\0') ) + capture = cvCaptureFromCAM( inputName.empty() ? 0 : inputName.c_str()[0] - '0' ); else if( inputName.size() ) { image = imread( inputName, 1 ); @@ -90,7 +82,7 @@ int main( int argc, const char** argv ) else image = imread( "lena.jpg", 1 ); - //cvNamedWindow( "result", 1 ); + cvNamedWindow( "result", 1 ); if( capture ) { @@ -151,9 +143,7 @@ _cleanup_: } } - //cvDestroyWindow("result"); - - cout << "average time " << (float)timeSum/(float)mcount; + cvDestroyWindow("result"); return 0; } @@ -162,10 +152,8 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade, CascadeClassifier& nestedCascade, double scale) { - static int imgIdx = 0; int i = 0; double t = 0; - char buf[200]; vector faces; const static Scalar colors[] = { CV_RGB(0,0,255), CV_RGB(0,128,255), @@ -177,12 +165,6 @@ void detectAndDraw( Mat& img, CV_RGB(255,0,255)} ; Mat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 ); - //sprintf( buf, "%s/%d.jpg", dirname.c_str(), ++imgIdx ); - //printf( "%s\n", buf ); - //printf("%d-%d\n", img.cols, img.rows ); - //imwrite( buf, img ); - //printf("OK!\n"); - cvtColor( img, gray, CV_BGR2GRAY ); resize( gray, smallImg, smallImg.size(), 0, 0, INTER_LINEAR ); equalizeHist( smallImg, smallImg ); @@ -196,8 +178,6 @@ void detectAndDraw( Mat& img, , Size(30, 30) ); t = (double)cvGetTickCount() - t; - timeSum += t/((double)cvGetTickFrequency()*1000.); - mcount++; printf( "detection time = %g ms\n", t/((double)cvGetTickFrequency()*1000.) ); for( vector::const_iterator r = faces.begin(); r != faces.end(); r++, i++ ) { @@ -229,8 +209,5 @@ void detectAndDraw( Mat& img, circle( img, center, radius, color, 3, 8, 0 ); } } - sprintf( buf, "%s/%d.jpg", dirname.c_str(), ++imgIdx ); - imwrite( buf, img ); - //cv::imshow( "result", img ); - //cvShowImage( "result", img ); + cv::imshow( "result", img ); } \ No newline at end of file diff --git a/opencv/src/cv/cvcascadedetect.cpp b/opencv/src/cv/cvcascadedetect.cpp index e96a412a..4535f018 100755 --- a/opencv/src/cv/cvcascadedetect.cpp +++ b/opencv/src/cv/cvcascadedetect.cpp @@ -660,7 +660,6 @@ inline int predictOrderedStump( CascadeClassifier& cascade, Ptr