00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00039 #include <stdio.h>
00040 #include <stdlib.h>
00041 #include <iostream>
00042 #include <QDebug>
00043
00044 #include <qvipp.h>
00045
00046 #include <QVApplication>
00047 #include <QVMPlayerCamera>
00048 #include <QVDefaultGUI>
00049 #include <QVImageCanvas>
00050 #include <QVNumericPlot>
00051 #include <QVHistogramPlot>
00052
00053 #ifndef DOXYGEN_IGNORE_THIS
00054 class MyWorker: public QVWorker
00055 {
00056 public:
00057 MyWorker(QString name): QVWorker(name)
00058 {
00059 addProperty< QVImage<uChar,1> >("Input image", inputFlag|outputFlag);
00060 addProperty< QVImage<uChar,1> >("Output image", outputFlag);
00061 addProperty<int>("Max pixel", outputFlag);
00062 addProperty<int>("Min pixel", outputFlag);
00063 addProperty<QList<double> >("MinMaxList", outputFlag);
00064 addProperty<QList<double> >("FirstRow", outputFlag);
00065 }
00066
00067 void iterate()
00068 {
00069 QVImage<uChar> image = getPropertyValue< QVImage<uChar,1> >("Input image");
00070
00071 uchar min, max;
00072 Max(image, max);
00073 Min(image, min);
00074 setPropertyValue<int>("Max pixel", max);
00075 setPropertyValue<int>("Min pixel", min);
00076 QList<double> minmaxlist;
00077 minmaxlist << min << max;
00078 setPropertyValue<QList<double> >("MinMaxList", minmaxlist);
00079
00080 QList<double> firstrow;
00081 for (uint i = 0; i < image.getCols(); i++) firstrow << image(i, 0);
00082 setPropertyValue<QList<double> >("FirstRow", firstrow);
00083
00084 QVImage<uChar> dest(image);
00085
00086 AddC(image, 10, dest);
00087
00088 setPropertyValue< QVImage<uChar,1> >("Output image", dest);
00089 }
00090 };
00091
00092 int main(int argc, char *argv[])
00093 {
00094 QVApplication app(argc, argv, "Example program for QVision library." );
00095
00096 MyWorker myWorker1("worker1");
00097 MyWorker myWorker2("worker2");
00098 QVMPlayerCamera camera("Video");
00099 camera.link(&myWorker1, "Input image");
00100 myWorker1.linkProperty("Output image", &myWorker2, "Input image", QVWorker::SynchronousLink);
00101
00102 QVDefaultGUI interface;
00103
00104 QVImageCanvas imageCanvas("image");
00105 imageCanvas.linkProperty(myWorker2, "Output image");
00106
00107 QVNumericPlot numericPlot("MinMax", false);
00108 numericPlot.linkProperty(myWorker1, "Max pixel");
00109 numericPlot.linkProperty(myWorker1, "Min pixel");
00110 numericPlot.linkProperty(myWorker2);
00111
00112 QVHistogramPlot histPlot1("histMinMax", false, 10, 300);
00113 histPlot1.linkProperty(myWorker1, "MinMaxList");
00114 histPlot1.linkProperty(myWorker2, "MinMaxList");
00115
00116 QVHistogramPlot histPlot2("histFirstRow", false, 10, 300);
00117 histPlot2.linkProperty(myWorker1, "FirstRow");
00118
00119
00120 return app.exec();
00121 }
00122
00123 #endif
00124