commit for github
[ozzloy@gmail.com/oble] / hello-world.cpp
index e9bb476485fbd668247e0ce104aa1276300b5e68..7d68365d76f153bf8073e24d9bb86514fc125d96 100644 (file)
@@ -2,14 +2,14 @@
 #include <highgui.h>
 #include <stdio.h>
 
-CvHaarClassifierCascade* load_object_detector( const char* cascade_path )
+CvHaarClassifierCascade* load_object_detector(const char* cascade_path)
 {
        return (CvHaarClassifierCascade*)cvLoad( cascade_path );
 }
 
-void detect_and_draw_objects( IplImage* image,
+void detect_and_draw_objects(IplImage* image,
                CvHaarClassifierCascade* cascade,
-               int do_pyramids )
+               int do_pyramids)
 {
        IplImage* small_image = image;
        CvMemStorage* storage = cvCreateMemStorage(0);
@@ -45,7 +45,8 @@ void detect_and_draw_objects( IplImage* image,
        cvReleaseMemStorage( &storage );
 }
 
-// A Simple Camera Capture Framework
+// A Simple Camera Capture Framework.
+>>>>>>> experimental:hello-world.cpp
 int main( int argc, char** argv )
 {
        CvHaarClassifierCascade* cascade = load_object_detector(argv[1]);
@@ -63,15 +64,19 @@ int main( int argc, char** argv )
        // Show the image captured from the camera in the window and repeat
        while( 1 ) {
                // Get one frame
-               IplImage* frame = cvQueryFrame( capture );
+               IplImage* frame = cvQueryFrame(capture);
+               IplImage* flipped = cvCreateImage(cvSize(frame->width, frame->height),
+                               frame->depth, frame->nChannels);
                if( !frame ) {
                        fprintf( stderr, "ERROR: frame is null...\n" );
                        getchar();
                        break;
                }
 
-               detect_and_draw_objects( frame, cascade, 1 );
-               cvShowImage( "mywindow", frame );
+               cvFlip(frame, flipped, 1);
+
+               detect_and_draw_objects(flipped, cascade, 1);
+               cvShowImage( "mywindow", flipped);
                // Do not release the frame!
 
                //If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),