00001 #ifndef IMAGEOUTPUT_H 00002 #define IMAGEOUTPUT_H 00003 00004 #include "output.h" 00005 #include "../recognition/imagesource.h" 00006 #include <string> 00007 00008 extern "C" 00009 { 00010 #include <opencv/highgui.h> 00011 } 00012 00013 namespace seemicro 00014 { 00015 00016 class ImageOutput : public OutputModule 00017 { 00018 ImageSource& src; 00019 string windowname; 00020 00021 public: 00022 ImageOutput(ImageSource& Asrc, string Awindowname) : 00023 src(Asrc), windowname(Awindowname) 00024 { 00025 cvNamedWindow(windowname.c_str(), 1); 00026 }; 00027 00028 ~ImageOutput() 00029 { 00030 cvDestroyWindow(windowname.c_str()); 00031 } 00032 00033 void output(bool keyframe) 00034 { 00035 if(!src.outputChanged) return; 00036 if(!keyframe) return; 00037 00038 cvShowImage(windowname.c_str(), src.img); 00039 cvResizeWindow(windowname.c_str(), src.img->width+15, src.img->height+15); 00040 src.outputChanged = false; 00041 } 00042 00043 }; // ImageOutput 00044 00045 } // seemicro 00046 00047 #endif
1.3.2