Alida-C++ 0.1

demo/operators/DemoOperatorOpenCV.cc

Go to the documentation of this file.
00001 /*
00002  * This file is part of the Alida-C++ library, an
00003  *
00004  * Advanced Library for Integrated Development of Data Analysis Applications.
00005  *
00006  * Copyright (C) 2012 - @YEAR@
00007  *
00008  * This program is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 3 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  *
00021  * Fore more information on Alida, visit
00022  *
00023  *    http://www.informatik.uni-halle.de/alida/
00024  *
00025  */
00026 
00027 /*
00028  * Most recent change(s):
00029  *
00030  * $Rev: 111 $
00031  * $Date: 2012-03-12 16:00:37 +0100 (Mo, 12 Mrz 2012) $
00032  * $Author: posch $
00033  *
00034  */
00035 
00036 #ifdef OPENCV_SUPPORT
00037 
00038 #include <math.h>
00039 #include <stdio.h>
00040 
00041 #include <fstream>
00042 #include <iostream>
00043 #include <string>
00044 
00045 #include <opencv/cv.h>
00046 
00047 #include "demo/operators/DemoOperatorOpenCV.h"
00048 #include "operator/ALDOperatorManager.h"
00049 
00054 REGISTER_OPERATOR(DemoOperatorOpenCV)
00055 
00056 
00062 DemoOperatorOpenCV::DemoOperatorOpenCV()
00063 {
00064   DEFINE_PARAMETER(IplImage, inputImg, PARAMETER_IN,
00065         true, false, "Input image", "Input image to be Gaussian filtered", NULL);
00066 
00067   DEFINE_PARAMETER(float, sigma, PARAMETER_IN,
00068         true, false, "Sigma", "Stddev of Gaussian", new float(1.4));
00069 
00070   DEFINE_PARAMETER(IplImage, outputImg, PARAMETER_OUT,
00071         true, false, "Output image", "Gaussian filtered image", NULL);
00072 }
00073 
00083 void DemoOperatorOpenCV::operate()
00084 {
00085     IplImage* image = ((IplImage*)(this->getParameter("inputImg")));
00086     std::cout << "Image size: " << image->width << std::endl;
00087     IplImage* outimage=
00088             cvCreateImage(cvSize(image->width,image->height),IPL_DEPTH_8U,image->nChannels);
00089     cvSmooth( image, outimage, CV_GAUSSIAN,
00090             *((float*)this->getParameter("sigma")),*((float*)this->getParameter("sigma")));
00091     this->setParameter("outputImg", outimage);
00092 }
00093 
00094 #endif /* OPENCV_SUPPORT */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines