examples/video-player/video-player.cpp

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00038 #include <stdio.h>
00039 #include <stdlib.h>
00040 #include <iostream>
00041 
00042 #include <qvcore/qvapplication.h>
00043 #include <qvcameras/qvmplayercamera.h>
00044 #include <qvgui/qvgui.h>
00045 
00047 class PlayerWorker: public QVWorker
00048         {
00049         public:
00050                 PlayerWorker(QString name): QVWorker(name)
00051                         {
00052                         addProperty< QVImage<uChar,1> >("Input image Y", inputFlag);
00053                         addProperty< QVImage<uChar,1> >("Input image U", inputFlag);
00054                         addProperty< QVImage<uChar,1> >("Input image V", inputFlag);
00055 
00056                         addProperty< QVImage<uChar,1> >("Output image Y", outputFlag);
00057                         addProperty< QVImage<uChar,1> >("Output image U", outputFlag);
00058                         addProperty< QVImage<uChar,1> >("Output image V", outputFlag);
00059                         }
00060 
00061                 void iterate()
00062                         {
00063                         QVImage<uChar, 1>       imageY = getPropertyValue< QVImage<uChar,1> >("Input image Y"),
00064                                                 imageU = getPropertyValue< QVImage<uChar,1> >("Input image U"),
00065                                                 imageV = getPropertyValue< QVImage<uChar,1> >("Input image V");
00066 
00067                         setPropertyValue< QVImage<uChar,1> >("Output image Y", imageY);
00068                         setPropertyValue< QVImage<uChar,1> >("Output image U", imageU);
00069                         setPropertyValue< QVImage<uChar,1> >("Output image V", imageV);
00070                         }
00071         };
00072 
00073 int main(int argc, char *argv[])
00074         {
00075         QVApplication app(argc, argv,
00076                 "Example program for QVision library. Shows the content of a video file."
00077                 );
00078 
00079         QVMPlayerCamera camera("Video");
00080         PlayerWorker worker("Video player worker");
00081         camera.link(&worker,"Input image Y", "Input image U", "Input image V");
00082 
00083         QVGUI interface;
00084 
00085         QVImageCanvas imageCanvasY("Output image Y");
00086         imageCanvasY.linkProperty(worker, "Output image Y");
00087 
00088         QVImageCanvas imageCanvasU("Output image U");
00089         imageCanvasU.linkProperty(worker, "Output image U");
00090 
00091         QVImageCanvas imageCanvasV("Output image V");
00092         imageCanvasV.linkProperty(worker, "Output image V");
00093 
00094         return app.exec();
00095         }
00096 

Generated on Fri Feb 22 18:26:55 2008 for QVision by  doxygen 1.5.3