PARP Research Group University of Murcia, Spain


src/qvworkers/qvhessianpointdetector.cpp

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007, 2008. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00024 
00025 #include <qvdta.h>
00026 #include <qvip.h>
00027 #include <qvipp.h>
00028 
00029 #include <QVMatrix>
00030 #include <QVHessianPointDetector>
00031 
00032 QVHessianPointDetector::QVHessianPointDetector(QString name): QVWorker(name)
00033         {
00034         addProperty< QVImage<uChar,3> >("Input image", inputFlag|outputFlag);
00035         addProperty< QVImage<uChar,1> >("Feature response image", outputFlag);
00036         addProperty< QList < QPointF > >("Feature locations", outputFlag);
00037         addProperty< int >("Max number of corners", inputFlag, 300, "Maximal number of points to detect", 10, 1000);
00038         }
00039 
00040 void QVHessianPointDetector::iterate()
00041         {
00042         // 0. Read input property values.
00043         const QVImage<uChar>    image = getPropertyValue< QVImage<uChar,3> >("Input image");
00044         const int               maxNumberCorners = getPropertyValue< int >("Max number of corners");
00045         const int               rows = image.getRows(), cols = image.getCols();
00046 
00047         timeFlag("Read input properties");
00048 
00049         // 2. Get candidate points from corner response image.
00050         QVImage<sFloat> cornerResponseImage(cols, rows);
00051         FilterHessianCornerResponseImage(image, cornerResponseImage);
00052         setPropertyValue< QVImage<uChar> >("Feature response image", cornerResponseImage);
00053         timeFlag("Feature response image");
00054 
00055         // 3. Store locations and intensities of points.
00056         const QList<QPointF> actualPoints = GetMaximalResponsePoints3(cornerResponseImage);
00057         timeFlag("Get corners and intensity responses");
00058 
00059         const int size = actualPoints.size();
00060         setPropertyValue< QList<QPointF> >("Feature locations", actualPoints.mid(MAX(0,size-maxNumberCorners),maxNumberCorners) );
00061         timeFlag("Store properties values");
00062         }
00063 



QVision framework. PARP research group, copyright 2007, 2008.