00001 // This is mul/ipts/ipts_corner_pyramid.cxx 00002 #include "ipts_corner_pyramid.h" 00003 //: 00004 // \file 00005 // \brief Compute corner strength at each level of a scale space pyramid 00006 // \author Tim Cootes 00007 00008 #include <vil/algo/vil_corners.h> 00009 #include <vimt/vimt_scale_pyramid_builder_2d.h> 00010 00011 //: Compute corner strength at each level of a scale space pyramid 00012 // Build smooth gaussian pyramid from the image, then compute corners at each level. 00013 // Use ipts_scale_space_peaks() to get the position and scale of likely corners 00014 void ipts_corner_pyramid(const vimt_image_2d_of<float>& image, 00015 vimt_image_pyramid& corner_pyramid, 00016 vimt_image_pyramid& smooth_pyramid, 00017 double scale_step) 00018 { 00019 vimt_scale_pyramid_builder_2d<float> pyr_builder; 00020 pyr_builder.set_scale_step(scale_step); 00021 pyr_builder.build(smooth_pyramid,image); 00022 00023 ipts_corner_pyramid(smooth_pyramid,corner_pyramid); 00024 } 00025 00026 //: Compute corner strength at each level of a scale space pyramid. 00027 // smooth_pyramid assumed to be of type float. 00028 // Use ipts_scale_space_peaks() to get the position and scale of 00029 // likely corners 00030 void ipts_corner_pyramid(const vimt_image_pyramid& smooth_pyramid, 00031 vimt_image_pyramid& corner_pyramid) 00032 { 00033 // Compute corners for all levels of an image pyramid 00034 corner_pyramid.resize(smooth_pyramid.n_levels(),vimt_image_2d_of<float>()); 00035 for (int i=0;i<smooth_pyramid.n_levels();++i) 00036 { 00037 const vimt_image_2d_of<float>& smooth_im 00038 = static_cast<const vimt_image_2d_of<float>&>(smooth_pyramid(i)); 00039 vimt_image_2d_of<float>& corner_im 00040 = static_cast<vimt_image_2d_of<float>&>(corner_pyramid(i)); 00041 corner_im.set_world2im(smooth_im.world2im()); 00042 vil_corners(smooth_im.image(),corner_im.image()); 00043 } 00044 }