00001 #ifndef CANNYOUTPUT_H
00002 #define CANNYOUTPUT_H
00003
00004 #include "output.h"
00005 #include "../recognition/canny.h"
00006
00007 extern "C"
00008 {
00009 #include <opencv/highgui.h>
00010 }
00011
00012 namespace seemicro
00013 {
00014
00015 class CannyOutput : public OutputModule
00016 {
00017 CannyModule& c;
00018
00029 static CannyOutput *home;
00030
00031 public:
00032 CannyOutput(CannyModule& Ac) :
00033 c(Ac)
00034 {
00035 cvNamedWindow("Canny", 1);
00036 cvCreateTrackbar("Canny1", "Canny", &c.canny1, 200, cannyCallback);
00037 cvCreateTrackbar("Canny2", "Canny", &c.canny2, 200, cannyCallback);
00038 home = this;
00039 };
00040
00041 ~CannyOutput()
00042 {
00043 cvDestroyWindow("Canny");
00044 }
00045
00046 void output(bool keyframe)
00047 {
00048 if(!c.outputChanged) return;
00049 if(!keyframe) return;
00050
00051 if(c.paramChanged)
00052 {
00053
00054
00055 cvSetTrackbarPos("Canny1", "Canny", c.canny1);
00056 cvSetTrackbarPos("Canny2", "Canny", c.canny2);
00057 }
00058 cvShowImage("Canny", c.img);
00059 cvResizeWindow("Canny", c.img->width+15, c.img->height+1+120);
00060 c.outputChanged = false;
00061 }
00062
00063 static void cannyCallback(int dummy)
00064 {
00065 if(!home) return;
00066 home->c.paramChanged = true;
00067 }
00068
00069 };
00070
00071 }
00072
00073 #endif