00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00046 #include <stdio.h>
00047 #include <stdlib.h>
00048 #include <iostream>
00049 #include <QDebug>
00050
00051 #include <QVApplication>
00052 #include <QVMPlayerCamera>
00053 #include <QVDefaultGUI>
00054 #include <QVImageCanvas>
00055 #include <qvipp.h>
00056
00057 #define RADIUS 1
00058
00059 #ifndef DOXYGEN_IGNORE_THIS
00060 class MyWorker: public QVWorker
00061 {
00062 public:
00063 MyWorker(QString name): QVWorker(name)
00064 {
00065 addProperty< QVImage<uChar,1> >("Input image", inputFlag|outputFlag);
00066 addProperty< QVImage<uChar,1> >("Output image", outputFlag);
00067 addProperty<QRect>("in rect selec", inputFlag);
00068 addProperty<QVPolyline>("in polyline", inputFlag);
00069 }
00070
00071 void iterate()
00072 {
00073 QVImage<uChar> image = getPropertyValue< QVImage<uChar,1> >("Input image");
00074 QRect rect = getPropertyValue<QRect>("in rect selec");
00075 QVPolyline poly = getPropertyValue<QVPolyline>("in polyline");
00076 QVImage<uChar> dest = image;
00077
00078
00079 if (rect != QRect()) image.setROI(rect);
00080 AddC(image, 10, dest, 1, QPoint(rect.x(), rect.y()));
00081 dest.resetROI();
00082
00083
00084 for (int i = 0; i < poly.size(); i++)
00085 {
00086 int x = poly[i].x(), y = poly[i].y();
00087 if ( (x >= 0) && (x < image.getCols()) && (y >= 0) && (y < image.getRows()) )
00088 dest(x, y) = image(x, y);
00089 }
00090
00091 setPropertyValue< QVImage<uChar,1> >("Output image", dest);
00092 }
00093 };
00094
00095 int main(int argc, char *argv[])
00096 {
00097 QVApplication app(argc, argv, "Example program for QVision library." );
00098
00099 MyWorker myWorker("worker");
00100 QVMPlayerCamera camera("Video");
00101 camera.link(&myWorker, "Input image");
00102
00103 QVDefaultGUI interface;
00104
00105 QVImageCanvas imageCanvas("image");
00106 imageCanvas.linkProperty(myWorker, "Output image");
00107 imageCanvas.linkROI(&myWorker, "in rect selec");
00108 imageCanvas.linkPolyline(&myWorker, "in polyline");
00109
00110 return app.exec();
00111 }
00112
00113 #endif
00114