contrib/mul/mfpf/mfpf_draw_matches.cxx
Go to the documentation of this file.
00001 #include "mfpf_draw_matches.h"
00002 //:
00003 // \file
00004 // \brief Function to draw a feature point on an image
00005 // \author Tim Cootes
00006 
00007 #include <mfpf/mfpf_point_finder.h>
00008 #include <mfpf/mfpf_draw_pose_lines.h>
00009 #include <mfpf/mfpf_pose_set.h>
00010 #include <vgl/vgl_point_2d.h>
00011 #include <vcl_algorithm.h>
00012 #include <vimt/vimt_convert.h>
00013 
00014 //: Draws first n_draw matches (defined by poses) into out_image
00015 //  Shape to draw defined by pf.get_outline(pts)
00016 void mfpf_draw_matches(const mfpf_point_finder& pf,
00017                        const vimt_image_2d_of<float>& image,
00018                        const mfpf_pose_set& matches,
00019                        unsigned n_draw,
00020                        vimt_image_2d_of<vxl_byte>& out_image)
00021 {
00022   vimt_convert_cast(image,out_image);
00023 
00024   unsigned nd = vcl_min(n_draw,unsigned(matches.poses.size()));
00025   double f = 250.0/nd;
00026   vcl_vector<vgl_point_2d<double> > m_pts;
00027   pf.get_outline(m_pts);
00028   mfpf_pose scale(0,0,pf.step_size(),0);
00029   for (unsigned j=0;j<nd;++j)
00030   {
00031     mfpf_draw_pose_lines(out_image,matches.poses[j]*scale,
00032                          m_pts,vxl_byte(255-j*f));
00033   }
00034 }