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 <qvdta.h>
00029 #include <qvip.h>
00030 #include <QVPolylineF>
00031
00032 #include <QVHarrisPointDetector>
00033
00034 Q_DECLARE_METATYPE(QList<QPointF>);
00035
00036 #ifndef DOXYGEN_IGNORE_THIS
00037 QVHarrisPointDetector::QVHarrisPointDetector(QString name): QVWorker(name)
00038 {
00039 addProperty< int >("Points", inputFlag, 15, "window size ", 1, 100);
00040 addProperty< double >("Threshold", inputFlag, 1.0, "window size ", 0.0, 256.0);
00041
00042 addProperty< QVImage<uChar,3> >("Input image", inputFlag|outputFlag);
00043 addProperty< QList<QPointF> >("Corners", outputFlag);
00044 }
00045
00046 void QVHarrisPointDetector::iterate()
00047 {
00048
00049 const QVImage<uChar> image = getPropertyValue< QVImage<uChar,3> >("Input image");
00050 const double threshold = getPropertyValue<double>("Threshold");
00051 const int pointNumber = getPropertyValue<int>("Points");
00052 timeFlag("grab Frame");
00053
00054
00055 QVImage<sFloat> cornerResponseImage(image.getRows(), image.getCols());
00056 FilterHessianCornerResponseImage(image, cornerResponseImage);
00057 timeFlag("Corner response image");
00058
00059
00060 QList<QPointF> hotPoints = GetMaximalResponsePoints3(cornerResponseImage, threshold);
00061 timeFlag("Local maximal filter");
00062
00063
00064
00065 setPropertyValue< QList<QPointF> >("Corners", hotPoints.mid(MAX(0,hotPoints.size() - pointNumber)));
00066 }
00067 #endif