degate  0.1.2
EdgeDetection.h
Go to the documentation of this file.
00001 /* -*-c++-*-
00002 
00003  This file is part of the IC reverse engineering tool degate.
00004 
00005  Copyright 2008, 2009, 2010 by Martin Schobert
00006 
00007  Degate is free software: you can redistribute it and/or modify
00008  it under the terms of the GNU General Public License as published by
00009  the Free Software Foundation, either version 3 of the License, or
00010  any later version.
00011 
00012  Degate 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 General Public License for more details.
00016 
00017  You should have received a copy of the GNU General Public License
00018  along with degate. If not, see <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00022 #ifndef __EDGEDETECTION_H__
00023 #define __EDGEDETECTION_H__
00024 
00025 #include <Image.h>
00026 #include <IPPipe.h>
00027 #include <ImageHelper.h>
00028 
00029 #include <IPCopy.h>
00030 #include <IPConvolve.h>
00031 #include <IPNormalize.h>
00032 #include <IPThresholding.h>
00033 #include <ImageManipulation.h>
00034 #include <IPImageWriter.h>
00035 
00036 namespace degate {
00037 
00038   class EdgeDetection {
00039 
00040   private:
00041 
00042     IPPipe pipe;
00043 
00044     unsigned int min_x, max_x, min_y, max_y;
00045     unsigned int median_filter_width;
00046 
00047     unsigned int blur_kernel_size, border;
00048     double sigma;
00049 
00050     TileImage_GS_DOUBLE_shptr i1, i2; // edge images (x direction and y direction)
00051 
00052     std::string directory; // path for storing debug images
00053     bool has_path;
00054 
00055   public:
00056 
00057     void setup_pipe();
00058 
00059 
00060     unsigned int get_width() const;
00061     unsigned int get_height() const;
00062 
00063     void set_directory(std::string const& path);
00064 
00065     std::string get_directory() const;
00066 
00067     bool has_directory() const;
00068 
00069     void run_edge_detection(ImageBase_shptr in);
00070 
00071     TileImage_GS_DOUBLE_shptr get_horizontal_edges();
00072     TileImage_GS_DOUBLE_shptr get_vertical_edges();
00073 
00074     TileImage_GS_DOUBLE_shptr get_edge_magnitude_image(TileImage_GS_DOUBLE_shptr probability_map);
00075 
00076     TileImage_GS_DOUBLE_shptr get_edge_image(TileImage_GS_DOUBLE_shptr probability_map);
00077 
00078 
00079   public:
00080 
00081     EdgeDetection(unsigned int _min_x, unsigned int _max_x,
00082                   unsigned int _min_y, unsigned int _max_y,
00083                   unsigned int median_filter_width = 3,
00084                   unsigned int _blur_kernel_size = 10,
00085                   double _sigma = 0.5);
00086 
00087     virtual ~EdgeDetection();
00088 
00089     unsigned int get_border() const;
00090 
00091 
00092   };
00093 
00094 }
00095 
00096 
00097 #endif