Go to the documentation of this file.00001
00002 #include "ipts_orientation_pyramid.h"
00003
00004
00005
00006
00007
00008 #include <vil/algo/vil_orientations.h>
00009 #include <vimt/vimt_image_2d_of.h>
00010 #include <vcl_cassert.h>
00011
00012
00013
00014
00015 void ipts_orientation_pyramid(const vimt_image_pyramid& smooth_pyramid,
00016 vimt_image_pyramid& orient_pyramid,
00017 float grad_threshold,
00018 unsigned n_orientations)
00019 {
00020 if (smooth_pyramid.n_levels()==0) return;
00021
00022 assert(smooth_pyramid(0).is_a()=="vimt_image_2d_of<float>");
00023
00024 int n_levels = smooth_pyramid.n_levels();
00025
00026
00027 orient_pyramid.resize(n_levels,vimt_image_2d_of<vxl_byte>());
00028 for (int i=0;i<n_levels;++i)
00029 {
00030 const vimt_image_2d_of<float>& smooth_im
00031 = static_cast<const vimt_image_2d_of<float>&>(smooth_pyramid(i));
00032 vimt_image_2d_of<vxl_byte>& orient_im
00033 = static_cast<vimt_image_2d_of<vxl_byte>&>(orient_pyramid(i));
00034
00035 vil_image_view<float> grad_i,grad_j,grad_mag;
00036 vil_sobel_3x3(smooth_im.image(),grad_i,grad_j);
00037 vil_orientations_at_edges(grad_i,grad_j,orient_im.image(),grad_mag,
00038 grad_threshold,n_orientations);
00039
00040 orient_im.set_world2im(smooth_im.world2im());
00041 }
00042 }