From: andrea on 22 Apr 2010 09:56 Hi at all, I visulize an image in a figure. Now I want when the user clicks on the left button of the mouse the point is red; if the user clicks the right button the point is yellow. How it works? Thanks in advace Andrea
From: Steven Lord on 22 Apr 2010 10:20 "andrea " <nacchio1983(a)yahoo.it> wrote in message news:hqpki4$2gc$1(a)fred.mathworks.com... > Hi at all, > > I visulize an image in a figure. Now I want when the user clicks on the > left button of the mouse the point is red; if the user clicks the right > button the point is yellow. > How it works? Look at the SelectionType property of the figure and the CurrentPoint property of the axes to determine which element of your image to modify and to what color it should be modified, then update the image's CData property appropriately. If you encounter problems doing so, post your code and a (small, say 5-by-5) image and explain what problem you're seeing. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
From: Jan Simon on 22 Apr 2010 10:28 Dear Andrea! > I visulize an image in a figure. Please define "image" with more details. > Now I want when the user clicks on the left button of the mouse the point is red; if the user clicks the right button the point is yellow. Please define "point" with more details. Do you want to add a point? Is the point a part of a line object? Kind regards, Jan
From: Beskie on 22 Apr 2010 13:57 Try adjusting this code into your program function main axes(handles.axes1); set(get(handles.axes1,'children'),'hittest','off'); set(handles.axes1,'ButtonDownFcn',{@AxesCallback,handles}); end function AxesCallback(src,eventdata,handles) TempPoint = get(handles.axes1,'CurrentPoint'); switch get(gcf,'selectiontype') case 'normal'%left mouse button click hold on plot(TempPoint(1,1),TempPoint(1,1),'o','MarkerSize', 10,'MarkerFaceColor','r') hold off case 'alt'%right mouse button click hold on plot(TempPoint(1,1),TempPoint(1,1),'o','MarkerSize', 10,'MarkerFaceColor','y') hold off end end
|
Pages: 1 Prev: hough transform circle detection Next: vector generation in a particular format |