Alida-C++ 0.1

demo/operators/Canny.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: 101 $
00031  * $Date: 2012-03-12 09:47:11 +0100 (Mo, 12. Mär 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/Canny.h"
00048 #include "operator/ALDOperatorManager.h"
00049 
00054 REGISTER_OPERATOR(Canny)
00055 
00056 
00061 Canny::Canny()
00062 {
00063   DEFINE_PARAMETER(IplImage, inputImg, PARAMETER_IN,
00064         true, false, "Input image", "Input image to be Gaussian filtered", NULL);
00065 
00066   DEFINE_PARAMETER(double, threshold1, PARAMETER_IN,
00067         true, false, "Threshold1", "First threshold for the hysteresis procedure", NULL);
00068 
00069   DEFINE_PARAMETER(double, threshold2, PARAMETER_IN,
00070         true, false, "Threshold2", "Second threshold for the hysteresis procedure", NULL);
00071 
00072   DEFINE_PARAMETER(IplImage, outputImg, PARAMETER_OUT,
00073         true, false, "Output image", "Gaussian filtered image", NULL);
00074 }
00075 
00080 void Canny::operate()
00081 {
00082     IplImage* image = ((IplImage*)(this->getParameter("inputImg")));
00083     std::cout << "Image size: " << image->width << std::endl;
00084     IplImage* outimage=
00085             cvCreateImage(cvSize(image->width,image->height),IPL_DEPTH_8U,1);
00086 
00087     cvCanny( image, outimage, 
00088             *((double*)this->getParameter("threshold1")),
00089             *((double*)this->getParameter("threshold2")));
00090     this->setParameter("outputImg", outimage);
00091 }
00092 
00093 #endif /* OPENCV_SUPPORT */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines