degate  0.1.2
ZeroCrossingEdgeDetection.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 __ZEROCROSSINGEDGEDETECTION_H__
00023 #define __ZEROCROSSINGEDGEDETECTION_H__
00024 
00025 #include <EdgeDetection.h>
00026 
00027 namespace degate {
00028 
00029   class ZeroCrossingEdgeDetection : public EdgeDetection {
00030 
00031   private:
00032 
00033     unsigned int min_d;
00034     unsigned int max_d;
00035     double edge_threshold, zero_threshold;
00036 
00037   private:
00038 
00039     bool trace(TileImage_GS_DOUBLE_shptr edge_image,
00040                int _x, int _y,
00041                int inc_x, int inc_y,
00042                int * start_x, int * stop_x,
00043                int * start_y, int * stop_y,
00044                double * mag,
00045                double edge_threshold,
00046                double zero_threshold,
00047                unsigned int min_d, unsigned int max_d);
00048 
00049     TileImage_GS_DOUBLE_shptr analyze_edge_image(TileImage_GS_DOUBLE_shptr edge_image,
00050                                                  TileImage_GS_DOUBLE_shptr probability_map,
00051                                                  unsigned int min_d, unsigned int max_d);
00052 
00053     void overlay_result(TileImage_GS_DOUBLE_shptr zc,
00054                         TileImage_GS_DOUBLE_shptr bg,
00055                         //TileImage_RGBA_shptr bg,
00056                         std::string const& directory) const;
00057   public:
00058 
00059     ZeroCrossingEdgeDetection(unsigned int min_x, unsigned int max_x,
00060                               unsigned int min_y, unsigned int max_y,
00061                               unsigned int median_filter_width = 3,
00062                               unsigned int blur_kernel_size = 10,
00063                               double sigma = 0.5,
00064                               unsigned int _min_d = 1, unsigned int _max_d = 10,
00065                               double _edge_threshold = 0.25, double _zero_threshold = 0.4);
00066 
00067     TileImage_GS_DOUBLE_shptr run(ImageBase_shptr img_in,
00068                                   TileImage_GS_DOUBLE_shptr probability_map,
00069                                   std::string const& directory);
00070 
00071     TileImage_GS_DOUBLE_shptr run(ImageBase_shptr img_in,
00072                                   TileImage_GS_DOUBLE_shptr probability_map);
00073 
00074 
00075   };
00076 
00077 }
00078 
00079 
00080 #endif