adding GPLv3 stuff
[ozzloy@gmail.com/oble] / hello-world.cpp
index e9bb476485fbd668247e0ce104aa1276300b5e68..8135cb4e4b5cbbdba8217a1675fd1e47611a8f3e 100644 (file)
@@ -1,15 +1,34 @@
+//use the camera to aid the decision to sleep.
+//Copyright 2009 Daniel Watson
+/*
+    This file is part of oble.
+
+    oble is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    oble is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with oble.  If not, see <http://www.gnu.org/licenses/>.
+
+ */
 #include <cv.h>
 #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 +64,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 +83,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),