PARP Research Group University of Murcia, Spain


src/qvworkers/qvharrispointdetector.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 <QList>
00026 #include <QPointF>
00027 
00028 #include <qvdta.h>
00029 #include <qvip.h>
00030 #include <QVPolylineF>
00031 
00032 #include <QVHarrisPointDetector>
00033 
00034 #ifndef DOXYGEN_IGNORE_THIS
00035 QVHarrisPointDetector::QVHarrisPointDetector(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< int >("Max number of corners", inputFlag, 300, "Maximal number of corners to detect", 10, 1000);
00041 
00042         addProperty< double >("Threshold", inputFlag, 1.0, "window size ", 0.0, 256.0);
00043         }
00044 
00045 void QVHarrisPointDetector::iterate()
00046         {
00047         // 0. Read input parameters
00048         const QVImage<uChar> image = getPropertyValue< QVImage<uChar,3> >("Input image");
00049         const double threshold = getPropertyValue<double>("Threshold");
00050         const int pointNumber = getPropertyValue<int>("Max number of corners");
00051         timeFlag("grab Frame");
00052 
00053         // 1. Obtain corner response image.
00054         QVImage<sFloat> cornerResponseImage(image.getRows(), image.getCols());
00055         FilterHessianCornerResponseImage(image, cornerResponseImage);
00056         timeFlag("Corner response image");
00057 
00058         // 2. Local maximal filter.
00059         QList<QPointF> hotPoints = GetMaximalResponsePoints3(cornerResponseImage, threshold);
00060         timeFlag("Local maximal filter");
00061 
00062         // 3. Output resulting data.
00063         //setPropertyValue< QVImage<uChar,1> >("Output image", image);
00064         setPropertyValue< QList<QPointF> >("Feature locations", hotPoints.mid(MAX(0,hotPoints.size() - pointNumber)));
00065         }
00066 #endif



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