2017-07-07 1 views
0

グレースケールの画像があります。これは、一部のセグメンテーションの後で、表示用にセクションを色に変換したものです。 しかし、同じ軸にグレースケール画像を表示した後、軸にカラー画像を表示することはできません。現在の軸をリセットして、MATLABの同じ軸にカラーまたはグレースケールイメージを表示するにはどうすればよいですか?

例:

function pushbutton1_Callback(hObject, eventdata, handles) 
% hObject handle to pushbutton1 (see GCBO) 
% eventdata reserved - to be defined in a future version of MATLAB 
% handles structure with handles and user data (see GUIDATA) 
global imB 
global imF 
global finalSegment_LE 
i=38; 
%   imB = img2{i} ;% Background original image 
tempSeg = finalSegment_LE{i}; 
tempSeg(finalSegment_LE{i} ==0) = min(finalSegment_LE{i}(:)); 
imF = tempSeg; 
cla(handles.axes1,'reset'); 
[~,~] = imoverlay(imB,imF,[],[],'hsv',0.8,handles.axes1); % color image.. 


% --- 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) 
% global imB 
temp = imread('cameraman.tif'); 
cla(handles.axes1,'reset'); 
axes(handles.axes1); 
imshow(temp,[]) % grayscale image... 

私が最初pushbutton1を押すと、私は、カラー画像を参照してください、私はpushbutton2を押した後、軸がグレースケールになると私はpushbutton1を押した場合でも、それはまだグレースケール画像を表示する代わりに、カラー画像。

おかげで、

答えて

0

%セットカラーマップ画像の種類に基づいて、表示する前に

Gopi

% --- Executes on button press in pushbutton1. 
function pushbutton1_Callback(hObject, eventdata, handles) 
% hObject handle to pushbutton1 (see GCBO) 
% eventdata reserved - to be defined in a future version of MATLAB 
% handles structure with handles and user data (see GUIDATA) 
[img,cmap] = imread('peppers.png'); 
cla(handles.axes1,'reset'); 
colormap(handles.axes1,cmap); 
axes(handles.axes1); 
imshow(img,[]); 


% --- 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) 
% global imB 
temp = imread('cameraman.tif'); 
cla(handles.axes1,'reset'); 
colormap(handles.axes1,gray); 
axes(handles.axes1); 
imshow(temp,[]) 
関連する問題