imellipse doesn't work on GUI axes
Show older comments
Dear all,
I have a GUI with an axes where I display an image. By pressing a pushbutton, I would like to apply the imellipse function on this image, but it fails and I don't have any idea why (in my opinion it doesn't make any sense):
% --- Executes on button press in hand_pushbutton.
function pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to hand_pushbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I = imread('coins.png');
handles.axes, imshow(I);
h = imellipse(handles.axes);
The error messege I get is:
??? Error using ==> hittest
Invalid object handle
Error in ==> ipthittest at 33
h = hittest(hFigure, currentPoint);
Error in ==> findLowestManagedObject at 16
hit_test_obj = imshared.ipthittest(hFigure,currentPoint);
Error in ==> iptPointerManager>createPointerManager/updatePointer at 280
overMe = findLowestManagedObject(hFigure,currentPoint);
Error in ==> iptPointerManager>createPointerManager/enablePointerManager at 218
updatePointer(figHandle, lastCurrentPoint);
Error in ==> iptPointerManager at 72
pointerManager.API.enable();
Error in ==> ellipseSymbol>setupCursorManagement at 301
iptPointerManager(h_fig);
Error in ==> ellipseSymbol>initialize at 121
setupCursorManagement();
Error in ==> imrect>imrectAPI at 220
draw_api.initialize(h_group)
Error in ==> imrect>imrect.imrect at 83
[h_group,draw_api] = imrectAPI(varargin{:});
Error in ==> imellipse>imellipse.imellipse at 89
obj = obj@imrect(varargin{:},'DrawAPI',ellipseSymbol());
Error in ==> newGUI>pushbutton_Callback at 997
h = imellipse(handles.axes);
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> newGUI at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)newGUI('pushbutton_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
Can you please give me a hint why this error occurs? Thank you in advance!
Answers (4)
Erwin
on 28 Feb 2012
0 votes
1 Comment
Alex Taylor
on 28 Feb 2012
Erwin, I just sent you an email. If you can distill this into a simple example, I'd be happy to take a look and get back to you.
Walter Roberson
on 28 Feb 2012
The line
handles.axes, imshow(I);
is going to output the numeric handle number for handles.axes, and is then going to imshow() against whatever the current axes happens to be at the time.
Use
imshow(I, 'Parent', handles.axes);
Image Analyst
on 28 Feb 2012
0 votes
Did it actually print a number to the command window when it hit this line: handles.axes ??? Are you sure that is the name of the axes? If you hover the cursor over handles (when it's stopped there because of a breakpoint) does it list axes as one of the members of the "handles" structure?
Erwin
on 29 Feb 2012
0 votes
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!