Reshowing an image in a programmatic gui
조회 수: 9 (최근 30일)
이전 댓글 표시
Hi,
I have programmed a gui in which I use hImage = imshow(image) to show a binary image. Then I add some stuff to the image handle like scrollpanels and magnification box etc. I then make changes to the image itself (remove stains by changing some areas into ones (white)).
How can I show the image again in the same gui by replacing the old image with the new, edited image?
Using imshow(image) causes a long error log because of handle errors. Redefining hImage = imshow(new_image) along with all other functionalities (scrollpanels etc.) also causes errors.
-Ville
댓글 수: 2
Sean de Wolski
2011년 7월 7일
Perhaps you could include some code. Are you using GUIDE?
Take a look at the axes command to get control of the axes directly.
답변 (1개)
Paulo Silva
2011년 7월 8일
Everytime you use imshow you must also give that image the tools, example:
handles.fig=figure
handles.ax=axes
handles.hImage = imshow('trees.tif'); % Show the image
% Set image hittest to 'on' so that it will react to mouse button presses
set(handles.hImage, 'HitTest', 'on', 'ButtonDownFcn', @button_down_fcn);
% Create scroll panels
handles.hScrollPanel = imscrollpanel(handles.fig, handles.hImage);
set(handles.hScrollPanel, 'Units', 'normalized','Position', [0 .1 1 .9]);
% Create magnification box
handles.hMagBox = immagbox(handles.fig, handles.hImage);
%pos = get(handles.hMagBox, 'Position');
set(handles.hMagBox, 'Position', [510, 25, 70, 25]); % Position the box
handles.hCoords = impixelinfo(handles.fig, handles.hImage); % coords box
pause(2)
handles.hImage = imshow('cameraman.tif'); % Show the image
% Set image hittest to 'on' so that it will react to mouse button presses
set(handles.hImage, 'HitTest', 'on', 'ButtonDownFcn', @button_down_fcn);
% Create scroll panels
handles.hScrollPanel = imscrollpanel(handles.fig, handles.hImage);
set(handles.hScrollPanel, 'Units', 'normalized','Position', [0 .1 1 .9]);
% Create magnification box
handles.hMagBox = immagbox(handles.fig, handles.hImage);
%pos = get(handles.hMagBox, 'Position');
set(handles.hMagBox, 'Position', [510, 25, 70, 25]); % Position the box
handles.hCoords = impixelinfo(handles.fig, handles.hImage); % coords box
댓글 수: 5
Image Analyst
2011년 7월 13일
MATLAB is case sensitive. So your "hIm" and "him" are different variables.
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!