contrib/mul/mfpf/mfpf_draw_pose_cross.cxx
Go to the documentation of this file.
00001 #include "mfpf_draw_pose_cross.h"
00002 //:
00003 // \file
00004 // \brief Function to draw a feature point on an image
00005 // \author Tim Cootes
00006 
00007 #include <mbl/mbl_draw_line.h>
00008 #include <vgl/vgl_point_2d.h>
00009 
00010 //: Draw oriented cross onto image, centred on pose.p()
00011 //  Orientation defined by pose.u(), size by (ru,rv)
00012 void mfpf_draw_pose_cross(vimt_image_2d_of<vxl_byte>& image,
00013                           const mfpf_pose& pose,
00014                           double ru, double rv,
00015                           vxl_byte value,unsigned width)
00016 {
00017   const vimt_transform_2d& w2im = image.world2im();
00018   vgl_point_2d<double> p1=pose.p()-ru*pose.u(), p2=pose.p()+ru*pose.u();
00019   vgl_point_2d<double> p3=pose.p()-rv*pose.v(), p4=pose.p()+rv*pose.v();
00020   mbl_draw_line(image.image(),w2im(p1),w2im(p2),value,width);
00021   mbl_draw_line(image.image(),w2im(p3),w2im(p4),value,width);
00022 }
00023 
00024 //: Draw oriented cross onto 3-plane image, centred on pose.p()
00025 //  Orientation defined by pose.u(), size by (ru,rv)
00026 void mfpf_draw_pose_cross(vimt_image_2d_of<vxl_byte>& image,
00027                           const mfpf_pose& pose,
00028                           double ru, double rv,
00029                           vxl_byte r, vxl_byte g, vxl_byte b)
00030 {
00031   const vimt_transform_2d& w2im = image.world2im();
00032   vgl_point_2d<double> p1=pose.p()-ru*pose.u(), p2=pose.p()+ru*pose.u();
00033   vgl_point_2d<double> p3=pose.p()-rv*pose.v(), p4=pose.p()+rv*pose.v();
00034   mbl_draw_line(image.image(),w2im(p1),w2im(p2),r,g,b);
00035   mbl_draw_line(image.image(),w2im(p3),w2im(p4),r,g,b);
00036 }
00037