Get marker 3D coordinate from the projected 2D-image by mouse click Vp = vb_get_ref_point(V,X,Y) --- Input V : 3D coordinate X : X-coordinate in projected 2D-space Y : Y-coordinate in projected 2D-space --- output Vp : selected 3D point Xp : selected X-coordinate Yp : selected Y-coordinate Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [Vp, Xp, Yp] = vb_get_proj_point(V,X,Y) 0002 % Get marker 3D coordinate from the projected 2D-image by mouse click 0003 % Vp = vb_get_ref_point(V,X,Y) 0004 % --- Input 0005 % V : 3D coordinate 0006 % X : X-coordinate in projected 2D-space 0007 % Y : Y-coordinate in projected 2D-space 0008 % --- output 0009 % Vp : selected 3D point 0010 % Xp : selected X-coordinate 0011 % Yp : selected Y-coordinate 0012 % 0013 % Copyright (C) 2011, ATR All Rights Reserved. 0014 % License : New BSD License(see VBMEG_LICENSE.txt) 0015 0016 % Input marker position by mouse click 0017 [xp,yp] = ginput(1); 0018 0019 % Find nearest 3D & 2D-coordinate to the target point 0020 [Vp, Xp, Yp, dmin] = vb_get_3d_point([xp,yp],V,X,Y); 0021 0022 0023 return 0024 0025 % Plot marker on 2D-image 0026 plot3(Xp,Yp,0,mtype1,'MarkerSize',msize1); 0027 0028 % Plot marker on 3D face 0029 subplot(1,2,2) 0030 plot3(Vp(:,1),Vp(:,2),Vp(:,3),mtype2,'MarkerSize',msize2);