|
degate 0.1.1
|
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 __CANNYEDGEDETECTION_H__ 00023 #define __CANNYEDGEDETECTION_H__ 00024 00025 #include <Image.h> 00026 00027 /* 00028 #include <IPPipe.h> 00029 #include <ImageHelper.h> 00030 00031 #include <IPCopy.h> 00032 #include <IPConvolve.h> 00033 #include <IPNormalize.h> 00034 #include <IPThresholding.h> 00035 #include <ImageManipulation.h> 00036 #include <IPImageWriter.h> 00037 #include <MedianFilter.h> 00038 00039 #include <QuadTree.h> 00040 #include <algorithm> 00041 #include <float.h> 00042 #include <fstream> 00043 */ 00044 00045 #include <EdgeDetection.h> 00046 00047 namespace degate { 00048 00049 00050 class CannyEdgeDetection : public EdgeDetection { 00051 00052 private: 00053 00054 double hysteresis_min; 00055 double hysteresis_max; 00056 00057 private: 00058 00059 void hysteresis(TileImage_GS_DOUBLE_shptr sup_edge_image); 00060 00061 00062 00063 void non_maximum_supression(TileImage_GS_DOUBLE_shptr horizontal_edges, 00064 TileImage_GS_DOUBLE_shptr vertical_edges, 00065 TileImage_GS_DOUBLE_shptr edge_image, 00066 TileImage_GS_DOUBLE_shptr sup_edge_image); 00067 00068 00069 // returns the direction in degrees 00070 int get_gradient_direction(TileImage_GS_DOUBLE_shptr horizontal_edges, 00071 TileImage_GS_DOUBLE_shptr vertical_edges, 00072 TileImage_GS_DOUBLE_shptr edge_mag_image, 00073 unsigned int x, unsigned int y); 00074 00075 public: 00076 00077 CannyEdgeDetection(unsigned int min_x, unsigned int max_x, 00078 unsigned int min_y, unsigned int max_y, 00079 unsigned int wire_diameter = 5, 00080 unsigned int median_filter_width = 3, 00081 unsigned int blur_kernel_size = 10, 00082 double sigma = 0.5, 00083 double _hysteresis_min = 0.28, 00084 double _hysteresis_max = 0.40); 00085 00086 ~CannyEdgeDetection(); 00087 00088 TileImage_GS_DOUBLE_shptr run(ImageBase_shptr img_in, 00089 TileImage_GS_DOUBLE_shptr probability_map, 00090 std::string const& directory); 00091 00092 TileImage_GS_DOUBLE_shptr run(ImageBase_shptr img_in, 00093 TileImage_GS_DOUBLE_shptr probability_map); 00094 00095 00096 }; 00097 00098 } 00099 00100 #endif 00101
1.7.4