Hauptseite | Liste aller Namensbereiche | Klassenhierarchie | Alphabetische Liste | Übersicht | Auflistung der Dateien | Elemente eines Namensbereiches | Datenstruktur-Elemente | Datei-Elemente

searchradius.h

gehe zur Dokumentation dieser Datei
00001 #ifndef SEARCHRADIUSOUTPUT_H
00002 #define SEARCHRADIUSOUTPUT_H
00003 
00004 #include "output.h"
00005 #include "../recognition/searchradius.h"
00006 #include <opencv/cv.hpp>
00007 #include <iostream>
00008 
00009 extern "C"
00010 {
00011   #include <opencv/highgui.h>
00012 }
00013 
00014 using namespace std;
00015 
00016 namespace seemicro
00017 {
00018 
00019 class SearchRadiusOutput : public OutputModule
00020 {
00021   IplImage *maxsearch;
00022   SearchRadiusModule& s;
00023   CvFont *font;
00024 public:
00025   SearchRadiusOutput(SearchRadiusModule& As, CvFont *Af) : s(As), font(Af)
00026   {
00027     if(1 != cvNamedWindow("SearchRadius", 1))
00028     { cerr << "cvNamedWindow(SearchRadius): error" << endl; exit(1); }
00029 
00030     maxsearch = cvCreateImage(cvSize(200,200), IPL_DEPTH_8U, 1);
00031   }
00032 
00033   ~SearchRadiusOutput()
00034   {
00035     cvReleaseImage(&maxsearch);
00036     cvDestroyWindow("SearchRadius");
00037   }
00038 
00039   void output(bool keyframe)
00040   {
00041     if(!s.outputChanged && !s.correlation.outputChanged) return;
00042 
00043     if(DEBUGLEVEL>=2)
00044       cout << "SearchRadius: Best fit for radius = " <<
00045         s.best << " pixels.\n";
00046 
00047     //cvZero(maxsearch);// schwarzer Hintergrund
00048     cvSet(maxsearch, cvScalar(255));
00049 
00050     CvPoint last=cvPoint(0, 200);
00051 
00052     float max = 1;
00053     const int radiusRange=s.MAXR-s.MINR;
00054     for(int i=0; i<radiusRange; i++) if(s.maximazGemittelt[i]>max) max=s.maximazGemittelt[i];
00055 
00056     for(int i=0; i<radiusRange; i++)
00057     {
00058       CvPoint next = cvPoint(i*200/radiusRange, 200 - int(s.maximazGemittelt[i]/max*200) );
00059       if(next.y < 0) next.y = 5;
00060       if(next.y >= maxsearch->height) next.y = maxsearch->height-5;
00061 
00062       cvLine(maxsearch, last, next, 0);
00063       last = next;
00064     }
00065     char text[100];
00066     sprintf(text, "Radius (%i bis %i)", s.MINR, s.MAXR);
00067     cvPutText(maxsearch, text, cvPoint(40, 195), font, CV_RGB(0, 0, 0));
00068     sprintf(text, "Korrelationsstaerke");
00069     cvPutTextSenkrecht(maxsearch, text, cvPoint(5, 180),
00070        font, CV_RGB(0, 0, 0), CV_RGB(255,255,255));
00071 
00072     // aktuell verwendeten Radius einzeichnen
00073     int x = int((s.correlation.micro.radius-s.MINR)*200/radiusRange);
00074     cvLine(maxsearch, cvPoint(x,200), cvPoint(x,0), CV_RGB(0,0,0));
00075 
00076     cvShowImage("SearchRadius", maxsearch);
00077     cvResizeWindow("SearchRadius", 215, 240);
00078 
00079     s.outputChanged=false;
00080 #ifdef DEBUG
00081     if(DEBUGLEVEL>=3) cerr << "<-SearchRadiusOutput::output()\n";
00082 #endif
00083   }
00084 
00085 }; // SearchRadiusOutput
00086 
00087 } // seemicro
00088 
00089 #endif
00090 

Erzeugt am Sun Oct 3 12:52:48 2004 für seemicro von doxygen 1.3.2