00001 // This is oxl/osl/osl_easy_canny.cxx 00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00003 #pragma implementation 00004 #endif 00005 //: 00006 // \file 00007 // \author fsm 00008 00009 #include "osl_easy_canny.h" 00010 00011 #include <vcl_cassert.h> 00012 #include <vcl_iostream.h> 00013 00014 #include <osl/osl_topology.h> 00015 00016 #include <osl/osl_canny_ox_params.h> 00017 #include <osl/osl_canny_ox.h> 00018 00019 #include <osl/osl_canny_rothwell_params.h> 00020 #include <osl/osl_canny_rothwell.h> 00021 00022 #include <osl/osl_edge_detector_params.h> 00023 #include <osl/osl_edge_detector.h> 00024 00025 void osl_easy_canny(int which_canny, 00026 vil1_image const &image, 00027 vcl_list<osl_edge*> *edges, 00028 double sigma) 00029 { 00030 assert(edges!=0); 00031 00032 switch (which_canny) { 00033 case 0: { 00034 osl_canny_ox_params params; 00035 if (sigma) 00036 params.sigma = (float)sigma; 00037 osl_canny_ox filter(params); 00038 filter.detect_edges(image, edges); 00039 } break; 00040 00041 case 1: { 00042 osl_canny_rothwell_params params; 00043 if (sigma) 00044 params.sigma = (float)sigma; 00045 osl_canny_rothwell filter(params); 00046 filter.detect_edges(image, edges); 00047 } break; 00048 00049 case 2: { 00050 osl_edge_detector_params params; 00051 if (sigma) 00052 params.sigma_ = (float)sigma; 00053 osl_edge_detector filter(params); 00054 filter.detect_edges(image, edges); 00055 } break; 00056 00057 default: 00058 vcl_cerr << __FILE__ ": unrecognised which_canny=" << which_canny << vcl_endl; 00059 break; 00060 } 00061 }