00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #include <QList>
00026 #include <QPointF>
00027
00028 #include <qvip.h>
00029 #include <QVPolylineF>
00030
00031 #include <QVHarrisPointDetector>
00032
00033 #ifndef DOXYGEN_IGNORE_THIS
00034 QVHarrisPointDetector::QVHarrisPointDetector(QString name): QVProcessingBlock(name)
00035 {
00036 addProperty< QVImage<uChar,3> >("Input image", inputFlag|outputFlag);
00037
00038 addProperty< QList < QPointF > >("Feature locations", outputFlag);
00039 addProperty< int >("Max number of corners", inputFlag, 300, "Maximal number of corners to detect", 10, 1000);
00040
00041 addProperty< double >("Threshold", inputFlag, 1.0, "window size ", 0.0, 256.0);
00042 }
00043
00044 void QVHarrisPointDetector::iterate()
00045 {
00046
00047 const QVImage<uChar> image = getPropertyValue< QVImage<uChar,3> >("Input image");
00048 const double threshold = getPropertyValue<double>("Threshold");
00049 const int pointNumber = getPropertyValue<int>("Max number of corners");
00050 timeFlag("grab Frame");
00051
00052
00053 QVImage<sFloat> cornerResponseImage(image.getRows(), image.getCols());
00054 FilterHarrisCornerResponseImage(image, cornerResponseImage);
00055 timeFlag("Harris corner response image");
00056
00057
00058 const QList<QPointF> hotPoints = fastMaximalPoints(cornerResponseImage, threshold).values();
00059 timeFlag("Point detection");
00060
00061
00062
00063 setPropertyValue< QList<QPointF> >("Feature locations", hotPoints.mid(0,pointNumber));
00064 }
00065 #endif