00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #include <qvdta.h>
00026 #include <qvip.h>
00027 #include <qvipp.h>
00028 #include <QVMatrix>
00029
00030 #include <QVHessianPointDetector>
00031
00032 Q_DECLARE_METATYPE(QList<QPointF>);
00033 Q_DECLARE_METATYPE(QList<sFloat>);
00034
00035 QVHessianPointDetector::QVHessianPointDetector(QString name): QVWorker(name)
00036 {
00037 addProperty< QVImage<uChar,3> >("Input image", inputFlag|outputFlag);
00038 addProperty< QVImage<uChar,1> >("Feature response image", outputFlag);
00039 addProperty< QList < QPointF > >("Feature locations", outputFlag);
00040 addProperty< QList < sFloat > >("Feature responses", outputFlag);
00041 addProperty< int >("Max number of corners", inputFlag, 300, "Maximal number of corners to detect", 10, 1000);
00042 }
00043
00044 void QVHessianPointDetector::iterate()
00045 {
00046
00047 const QVImage<uChar> image = getPropertyValue< QVImage<uChar,3> >("Input image");
00048 const int maxNumberCorners = getPropertyValue< int >("Max number of corners");
00049 const int rows = image.getRows(), cols = image.getCols();
00050
00051 timeFlag("Read input properties");
00052
00053
00054 QVImage<sFloat> cornerResponseImage(cols, rows);
00055 FilterHessianCornerResponseImage(image, cornerResponseImage);
00056 setPropertyValue< QVImage<uChar> >("Feature response image", cornerResponseImage);
00057 timeFlag("Feature response image");
00058
00059
00060 const QList< QPair<sFloat, QPointF> > maximalPointsPlusResponses = GetMaximalResponsePoints3bis(cornerResponseImage);
00061 const QList<sFloat> actualResponses = getFirstPairList<sFloat, QPointF>(maximalPointsPlusResponses);
00062 const QList<QPointF> points = getSecondPairList<sFloat, QPointF>(maximalPointsPlusResponses);
00063 const QList<QPointF> actualPoints = getSecondPairList<sFloat, QPointF>(maximalPointsPlusResponses);
00064 timeFlag("Get corners and intensity responses");
00065
00066 const int size = actualResponses.size();
00067 setPropertyValue< QList<sFloat> >("Feature responses", actualResponses.mid(MAX(0,size-maxNumberCorners),maxNumberCorners) );
00068 setPropertyValue< QList<QPointF> >("Feature locations", actualPoints.mid(MAX(0,size-maxNumberCorners),maxNumberCorners) );
00069 timeFlag("Store properties values");
00070 }
00071