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 <QVIPP>
00038
00039 #define RADIUS 1
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<QRect>("in rect selec", inputFlag);
00050 addProperty<QVPolyline>("in polyline", inputFlag);
00051 }
00052
00053 void iterate()
00054 {
00055 QVImage<uChar> image = getPropertyValue< QVImage<uChar,1> >("Input image");
00056 QRect rect = getPropertyValue<QRect>("in rect selec");
00057 QVPolyline poly = getPropertyValue<QVPolyline>("in polyline");
00058 QVImage<uChar> dest(image);
00059
00060
00061 if (rect != QRect()) image.setROI(rect);
00062 AddC(image, dest, 10);
00063 dest.resetROI();
00064
00065
00066 for (int i = 0; i < poly.size(); i++)
00067 {
00068 int x = poly[i].x(), y = poly[i].y();
00069
00070
00071 if ( (x >= 0) && (x < image.getCols()) && (y >= 0) && (y < image.getRows()) )
00072 dest(x, y) = image(x, y);
00073 }
00074
00075 setPropertyValue< QVImage<uChar,1> >("Output image", dest);
00076 }
00077 };
00078
00079 int main(int argc, char *argv[])
00080 {
00081 QVApplication app(argc, argv, "Example program for QVision library." );
00082
00083 MyWorker myWorker("worker");
00084 QVMPlayerCamera camera("Video");
00085 camera.link(&myWorker, "Input image");
00086
00087 QVGUI interface;
00088
00089 QVImageCanvas imageCanvas("image");
00090 imageCanvas.linkProperty(myWorker, "Output image");
00091 imageCanvas.linkROI(&myWorker, "in rect selec");
00092 imageCanvas.linkPolyline(&myWorker, "in polyline");
00093
00094 return app.exec();
00095 }
00096
00097 #endif
00098