Howto updated/manipulated image between the callbacks

조회 수: 1 (최근 30일)
Lluis Roca
Lluis Roca 2013년 10월 14일
댓글: Walter Roberson 2013년 10월 14일
Hi,
I have several push buttons that performs image analysis (e.g., load an image, convert to gray scale). I wish to share the updated/manipulated image between the callbacks but I get an error.
Therefore, how can I update the image and share it between the callbacks?
Code for example:
function loadImageButton_Callback(hObject, eventdata, handles)
% hObject handle to loadImageButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I = imread('D:\Image\tele.jpg');
axes(handles.imageAxes);
imshow(I);
guidata(hObject, handles);
function convertGSbutton_Callback(hObject, eventdata, handles)
% hObject handle to convertGSbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I = rgb2gray(I);
axes(handles.imageAxes);
imshow(I);
guidata(hObject, handles);
Thanks

채택된 답변

Walter Roberson
Walter Roberson 2013년 10월 14일
  댓글 수: 2
Lluis Roca
Lluis Roca 2013년 10월 14일
Thanks.
I used the SETAPPDATA and GETAPPDATA.
What would be my 'yourVariable' in my case?
Walter Roberson
Walter Roberson 2013년 10월 14일
The data you want shared. "I" in this case.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by