00001 // This is brl/bseg/vpro/vpro_harris_corner_process.cxx 00002 #include "vpro_harris_corner_process.h" 00003 //: \file 00004 #include <vcl_iostream.h> 00005 #include <vcl_vector.h> 00006 #include <vsol/vsol_point_2d.h> 00007 #include <vil1/vil1_memory_image_of.h> 00008 #include <sdet/sdet_harris_detector.h> 00009 00010 vpro_harris_corner_process::vpro_harris_corner_process(sdet_harris_detector_params & hdp) 00011 : sdet_harris_detector_params(hdp) 00012 { 00013 } 00014 00015 vpro_harris_corner_process::~vpro_harris_corner_process() 00016 { 00017 } 00018 00019 bool vpro_harris_corner_process::execute() 00020 { 00021 if (this->get_N_input_images() != 1) 00022 { 00023 vcl_cout << "In vpro_harris_corner_process::execute() - not exactly one input image\n"; 00024 return false; 00025 } 00026 output_spat_objs_.clear(); 00027 //assume the input images are grey scale (should really check) 00028 vil1_memory_image_of<unsigned char> img(vpro_video_process::get_input_image(0)); 00029 vpro_video_process::clear_input(); 00030 sdet_harris_detector harris_detector(*(static_cast<sdet_harris_detector_params*>(this))); 00031 harris_detector.set_image(img); 00032 harris_detector.extract_corners(); 00033 vcl_vector<vsol_point_2d_sptr>& points = harris_detector.get_points(); 00034 int N = points.size(); 00035 if (!N) 00036 return false; 00037 for (int i = 0; i<N; i++) 00038 output_spat_objs_.push_back(points[i]->cast_to_spatial_object()); 00039 00040 output_topo_objs_.clear(); 00041 output_image_ = 0; 00042 return true; 00043 }
1.7.5.1