PARP Research Group | Universidad de Murcia |
examples/designer/designer.cppGo to the documentation of this file.00001 /* 00002 * Copyright (C) 2008, 2009, 2010, 2011, 2012. 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 00040 #include <QVDesignerGUI> 00041 #include <QVApplication> 00042 #include <QVCannyEdgeDetector> 00043 #include <QVVideoReaderBlock> 00044 #include <QVImageCanvas> 00045 00046 #include <QVProcessingBlock> 00047 #include <qvip.h> 00048 00049 //#include <qvipp.h> 00050 00051 #include <qvmath.h> 00052 #include <QV2DMap> 00053 00054 #ifndef DOXYGEN_IGNORE_THIS 00055 /*class QVMyFilterHipass: public QVProcessingBlock 00056 { 00057 public: 00058 QVMyFilterHipass(QString name = QString()): QVProcessingBlock(name) 00059 { 00060 addProperty< QVImage<uChar,3> >("Input image", inputFlag|outputFlag); 00061 addProperty< QVImage<uChar,3> >("Output image", outputFlag); 00062 addProperty< IppiMaskSize >("mask", inputFlag, ippMskSize5x5); 00063 addProperty< QPoint >("destROIOffset", inputFlag); 00064 } 00065 00066 void iterate() 00067 { 00068 // 0. Read input image. 00069 const QVImage<uChar, 3> qvimage_pSrc = getPropertyValue< QVImage<uChar, 3> > ("Input image"); 00070 const IppiMaskSize mask = getPropertyValue< IppiMaskSize > ("mask"); 00071 const QPoint destROIOffset = getPropertyValue< QPoint > ("destROIOffset"); 00072 00073 QVImage<uChar, 3> qvimage_pDst; 00074 00075 FilterHipass(qvimage_pSrc, qvimage_pDst, mask, destROIOffset); 00076 setPropertyValue< QVImage<uChar, 3> >("Output image", qvimage_pDst); 00077 } 00078 };*/ 00079 00080 class QVSFloatC1MaximalPoints: public QVProcessingBlock 00081 { 00082 public: 00083 QVSFloatC1MaximalPoints(QString name = QString()): QVProcessingBlock(name) 00084 { 00085 // Input properties 00086 addProperty< QVImage<sFloat> >("Input image", inputFlag|outputFlag); 00087 addProperty< double >("Threshold", inputFlag); 00088 addProperty< int >("Radius", inputFlag); 00089 00090 // Output properties 00091 addProperty< QList<QPointF> >("max", outputFlag); 00092 } 00093 00094 void iterate() 00095 { 00096 // 0. Read input image. 00097 const QVImage<sFloat> image = getPropertyValue< QVImage<sFloat> >("Input image"); 00098 const double threshold = getPropertyValue< double >("Threshold"); 00099 const int radius = getPropertyValue< int >("Radius"); 00100 00101 QMap<sFloat, QPointF> map = maximalPoints(image, threshold, radius); 00102 00103 // 1. Export single-channel images 00104 setPropertyValue< QList<QPointF> >("max", map.values()); 00105 } 00106 }; 00107 00108 int main(int argc, char *argv[]) 00109 { 00110 QVApplication app(argc, argv, "Example application for QVision.", true ); 00111 00112 //QVDesignerGUI::registerUserType<QVMyFilterHipass>("QVMyFilterHipass"); 00113 QVDesignerGUI::registerUserType<QVSFloatC1MaximalPoints>("QVSFloatC1MaximalPoints"); 00114 00115 // QVMyFilterHipass hipass("Hipass"); 00116 QVSFloatC1MaximalPoints max("Maximal"); 00117 00118 QVDesignerGUI interface; 00119 00120 return app.exec(); 00121 } 00122 00123 #endif |