00001 // This is core/vil/algo/vil_line_filter.h 00002 #ifndef vil_line_filter_h_ 00003 #define vil_line_filter_h_ 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \brief Find line-like structures in a 2D image 00010 // \author Tim Cootes 00011 00012 #include <vil/vil_image_view.h> 00013 00014 //: Find line-like structures in a 2D image 00015 // Generates two images: line_str contains line strength at each pixel, 00016 // essentially the difference between the average of the pixels on 00017 // the line and the average of those nearby off the line. 00018 // and line_dir contains value indicating direction [0,4] 00019 // 0 = Undefined, 1 = horizontal, 2 = 45 degrees etc 00020 00021 template<class Type> 00022 class vil_line_filter 00023 { 00024 public: 00025 //: Find line like structures in image (light lines on dark backgrounds) 00026 // On exit line_str contains line strength at each pixel, 00027 // line_dir contains value indicating direction [0,4] 00028 // 0 = Undefined, 1 = horizontal, 2 = 45 degrees etc 00029 // This version looks for light lines on a dark background only. 00030 void light_lines_3x3(vil_image_view<vxl_byte>& line_dir, 00031 vil_image_view<float>& line_str, 00032 const vil_image_view<Type>& image, 00033 float edge_thresh=0.1f); 00034 00035 //: Find line like structures in image (dark lines on light backgrounds) 00036 // On exit line_str contains line strength at each pixel, 00037 // line_dir contains value indicating direction [0,4] 00038 // 0 = Undefined, 1 = horizontal, 2 = 45 degrees etc 00039 // This version looks for dark lines on a light background only. 00040 void dark_lines_3x3(vil_image_view<vxl_byte>& line_dir, 00041 vil_image_view<float>& line_str, 00042 const vil_image_view<Type>& image, 00043 float edge_thresh=0.1f); 00044 00045 //: Find line like structures in image (light lines on dark backgrounds) 00046 // On exit line_str contains line strength at each pixel, 00047 // line_dir contains value indicating direction [0,4] 00048 // 0 = Undefined, 1 = horizontal, 2 = 45 degrees etc 00049 // This version looks for light lines on a dark background only 00050 // using a 5x5 filter 00051 void light_lines_5x5(vil_image_view<vxl_byte>& line_dir, 00052 vil_image_view<float>& line_str, 00053 const vil_image_view<Type>& image, 00054 float edge_thresh=0.1f); 00055 00056 //: Find line like structures in image (dark lines on light backgrounds) 00057 // On exit line_str contains line strength at each pixel, 00058 // line_dir contains value indicating direction [0,4] 00059 // 0 = Undefined, 1 = horizontal, 2 = 45 degrees etc 00060 // This version looks for dark lines on a light background only 00061 // using a 5x5 filter 00062 void dark_lines_5x5(vil_image_view<vxl_byte>& line_dir, 00063 vil_image_view<float>& line_str, 00064 const vil_image_view<Type>& image, 00065 float edge_thresh=0.1f); 00066 }; 00067 00068 #endif 00069