Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
ginput point gives a different shape

Subject: ginput point gives a different shape

From: mohammad elgarrai

Date: 6 Mar, 2011 09:18:04

Message: 1 of 3

I want to use Active shape modeling (ASM) but I face problem's with collecting point.

I am having trouble in the plotting points on the axes , I've collect the values of these points using the function (ginput), in my gui I plot any point as I select it immediately these point appears correctly in the axes at this time, but when I plot the same points using plot in the same axes it gives a different shape smaller than the true shape.

Subject: ginput point gives a different shape

From: Sadik

Date: 6 Mar, 2011 21:09:05

Message: 2 of 3

Hello Mohammad,

If you look at the help documentation on ginput, you may see the following at the very end:

"Consider setting XLimMode and YLimMode to 'manual' if you want to maintain consistency when you gather results from ginput and plot them together."

So it is suggested that you do:

set(gca,'XLimMode','Manual','YLimMode','Manual')

If you do this carefully, that should solve the problem.

Best.

Subject: ginput point gives a different shape

From: mohammad elgarrai

Date: 16 Mar, 2011 11:35:19

Message: 3 of 3

Thanks
I have used the way that you have explained and unfortunately it did not do any good
There is still something I do not understand
In the first part i plot the image and then collect the points (Land Mark) for (ASM) Code:

function plot_image(my_handles)
i=my_handles.selected_image_number;
set(my_handles.image_number_text,'String',num2str(i));
set(my_handles.image_name,'String',my_handles.files_name(i).name);
my_image=my_handles.images{i};
axes(my_handles.image_axes);
set(gca,'XLimMode','Manual','YLimMode','Manual')
imshow(my_image)
grid on;
 
the collect the points function

function landmark_pushbutton_Callback(hObject, eventdata, handles)
set(handles.select_model_button,'Enable','off');
disable_button(handles)
set(handles.set_land_button,'Enable','off');
set(handles.number_edit,'Enable','off');
set(handles.landmark_pushbutton,'Enable','off');
X=[];
Y=[];
L=get(handles.number_edit,'string');
L=str2num(L);
while 1
   hold on
   plot(Y,X,'c+:');
   if (nargin==3)
      if(length(X)==L)
         return;
      end
   end
   [yc,xc,button]=ginput(1);
   plot(yc,xc,'c+:');
   if (button==2 | button==3) & (nargin<3) %finish
      return
   elseif button==32 %delete the closest
      [val,ind]=min((xc-X).^2 + (yc-Y).^2);
   else %landmark
      X=[X;xc];
      Y=[Y;yc];
   end
   data=[X,Y]
   set(handles.point_table,'data',data);
end

and in following part I plot the point that stored in the first part code:

function plot_point(my_handles)
   my_handles.data
   try
   plot(my_handles.data,'c+:');
   end


http://www.flickr.com/photos/44160800@N08/5531354093/#/

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us