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