00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00040 #include <stdio.h>
00041 #include <stdlib.h>
00042 #include <iostream>
00043 #include <QDebug>
00044
00045 #include <qvip.h>
00046 #include <qvipp.h>
00047
00048 #include <QVApplication>
00049 #include <QVVideoReaderBlock>
00050 #include <QVDefaultGUI>
00051 #include <QVImageCanvas>
00052
00053 #ifndef DOXYGEN_IGNORE_THIS
00054 class MyBlock: public QVProcessingBlock
00055 {
00056 public:
00057 MyBlock(QString name): QVProcessingBlock(name)
00058 {
00059 addProperty< QVImage<uChar,1> >("Input image", inputFlag|outputFlag);
00060 addProperty< QVImage<uChar,1> >("Laplace image", outputFlag);
00061 addProperty< QList<QPointF> >("Laplace features", outputFlag);
00062
00063 addProperty< bool >("Show Laplace features", inputFlag, true);
00064 addProperty< int >("Threshold", inputFlag, 32, "Maximal detection threshold", 0, 64);
00065 }
00066
00067 void iterate()
00068 {
00069 const QVImage<uChar,1> image = getPropertyValue< QVImage<uChar,1> >("Input image");
00070 const bool showLaplaceFeatures = getPropertyValue< bool >("Show Laplace features");
00071 const int threshold = getPropertyValue< int >("Threshold");
00072 timeFlag("init");
00073
00074 const QVImage<uChar, 1> laplaceImage = FastLaplaceFilter(image);
00075 timeFlag("Laplace filter");
00076
00077 const QList<QPointF> points = FastLaplacePoints(image, threshold);
00078 timeFlag("Laplace points");
00079
00080 setPropertyValue< QVImage<uChar,1> >("Laplace image", laplaceImage);
00081
00082 if (showLaplaceFeatures)
00083 setPropertyValue< QList<QPointF> >("Laplace features", points);
00084 else
00085 setPropertyValue< QList<QPointF> >("Laplace features", QList<QPointF>());
00086 }
00087 };
00088
00089 int main(int argc, char *argv[])
00090 {
00091 QVApplication app(argc, argv,
00092 "Example program for QVision library. Shows Laplace response image and features.");
00093
00094 QVVideoReaderBlock camera("Video");
00095 MyBlock block("Laplace block");
00096 camera.linkProperty(&block,"Input image");
00097
00098 QVDefaultGUI interface;
00099
00100 QVImageCanvas inputImage("Input image");
00101 block.linkProperty("Input image", inputImage);
00102
00103 QVImageCanvas laplaceImage("Laplace image");
00104 block.linkProperty("Laplace image", laplaceImage);
00105 block.linkProperty("Laplace features", laplaceImage);
00106 laplaceImage.setRadius("Laplace features", 2);
00107
00108 return app.exec();
00109 }
00110
00111 #endif
00112