필터 지우기
필터 지우기

help required urgently about this error "REFERENCE TO NON EXISTENT FIELD"

조회 수: 2 (최근 30일)
im currently working on this thing which converts an rgb image to indexed when i press pushbutton 2 and then it will convert the map to ycbcr when i'll press pushbutton 3 but when i press pushbutton 3 it gives an error "106 inmap = handles.indmap; ??? Reference to non-existent field 'indmap'."
code is this :
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
rgb=imread('C:\Users\Rao\Desktop\unused icons\backgrounds\birdie.png');
[handles.indexed,handles.indmap]=rgb2ind(rgb,8);
axes(handles.axes2);
imagesc(handles.indexed);
colormap(handles.indmap);
% --- Executes on button press in pushbutton3. function pushbutton3_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
handles.ycbcrmap = rgb2ycbcr(handles.indmap);
axes(handles.axes3);
imagesc(handles.indexed);
colormap(handles.ycbcrmap);
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 6월 19일
http://www.mathworks.com/matlabcentral/answers/29922-why-your-question-is-not-urgent-or-an-emergency

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

채택된 답변

Arthur
Arthur 2012년 6월 19일
you have to save the handles structure at the end of the callback if you want to store something in there. At the end of pushbutton2_Callback add:
guidata(gcbo,handles)
(I'm not a big fan of storing your data in the handles structure, but that's a different discussion ;) ).
  댓글 수: 2
Rao
Rao 2012년 6월 19일
thanx pal it works :)
im having one more problem when i click the push button to convert the indexed image map to ycbcr and after i display the image using the new map i.e (ycbcr) , the image in axes2 i.e the image using rgb colormap also changes to and uses ycbcr now both images are same in axes 2 and 3 and when i press the pushbutton 2 the image in both axes 2 and 3 uses rgb colormap . i think it is related to handles.indexed image .. any suggestions please im stuck with this and i have to submit a report of this tomorrow.. :-(
Image Analyst
Image Analyst 2012년 6월 19일
http://www.mathworks.com/support/solutions/en/data/1-GNRWEH/index.html

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

추가 답변 (1개)

Arthur
Arthur 2012년 6월 19일
This is probably due to using colormap without axes handle. try:
colormap(handles.axes3,handles.ycbrmap)
or see: doc colormap
  댓글 수: 1
Rao
Rao 2012년 6월 19일
this doesnt help :-( i keep getting same image in both axes when i click pushbutton 2 it display image with rgb colormap in both axes similarly when im pressing pushbutton 3 it displays image with ycbcr colormap in both axes.. :-|
maybe the image "handles.indexed" is global so the colormap is applying on it in both buttons

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

카테고리

Help CenterFile Exchange에서 Blue에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by