handles.img=f;
guidata(hObject,handles); case'¼õÈõ' T=getimage;
prompt={'ÊäÈë²ÎÊý:'}; defans={'1'};
p=inputdlg(prompt,'input',1,defans); p1=str2num(p{1});
f=imdivide(handles.img,p1); imshow(f); handles.img=f;
guidata(hObject,handles); end
¸Ã³ÌÐò¶ÎÖ÷Ҫͨ¹ý f=immultiply(handles.img,p1); p=inputdlg(prompt,'input',1,defans); ·Ö±ðʵÏÖͼÏñ¶Ô±È¶ÈµÄÔöÇ¿Óë¼õÈõ¡£
4£®4 ÓÃÊó±êѡȡͼÏñ¸ÐÐËÈ¤ÇøÓò£¬ÏÔʾºÍ±£´æ¸ÃÑ¡ÔñÇøÓò¡£
ͨ¹ýimcrop(x)º¯ÊýÀ´ÊµÏÖ¶ÔÍ¼Æ¬Ä³Ò»ÇøÓòµÄ½ØÈ¡£¬½ØÈ¡µÄͼƬÔÚÓÒ¿òÖÐÏÔʾ¡£½áºÏ¡°±£´æÎª?¡±,¿É°Ñ½ØÍ¼´¦ÀíºóµÄͼƬ±£´æÔÚÖ¸¶¨Â·¾¶¡£
ʵÏÖ³ÌÐò¶ÎÈçÏ£º
13 / 52
% --- 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) global T
axes(handles.axes2); T=getimage;
x=imcrop(handles.img); %½ØÍ¼ imshow(x); handles.img=x;
guidata(hObject,handles);
4.5 ͼÏñת»¯Îª»Ò¶ÈͼÏñ¡£
ÓÉÓÚÔÚmatlabÖн϶àµÄͼÏñ´¦Àíº¯ÊýÖ§³Ö¶Ô»Ò¶ÈͼÏñ½øÐд¦Àí£¬¹Ê¶ÔͼÏñ½øÐлҶÈת»¯Ê®·Ö±ØÒª¡£¿ÉÀûÓÃrgb2gray£¨X£©º¯Êý¶ÔÆäËûͼÏñ½øÐлҶÈͼÏñµÄת»¯¡£ ת»¯ÊµÀýÈçÏ£º
ʵÏÖ³ÌÐò¶ÎÈçÏ£º
% --- Executes on button press in radiobutton16.
function radiobutton16_Callback(hObject, eventdata, handles) % hObject handle to radiobutton16 (see GCBO)
14 / 52
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton16 global T
axes(handles.axes2); T=getimage;
x=rgb2gray(handles.img); %RGB¨ª???¡Áa???a?¨°?¨¨¨ª??? imshow(x); handles.img=x;
guidata(hObject,handles);
4.6¶ÔͼÏñ½øÐзŴóºÍËõСÕûÊý±¶µÄ²Ù×÷¡£
ͨ¹ýimresize(X£¬n£¬mode)º¯Êý¶ÔͼÏñX½øÐзŴó»òÕßËõС¡£N·Å´óËõС±¶Êý£¬modeΪ²ÉÓõķ½Ê½¡£
ͨ¹ý´¦Àíºó¿É·¢ÏÖ±£´æµÄͼƬµÄ±ÈÔͼ·Å´óÁË£¨ËõСÁË£©¡£ ʵÏֵijÌÐò¶ÎÈçÏ£º
function uipanel9_SelectionChangeFcn(hObject, eventdata, handles) % hObject handle to uipanel9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global T
str=get(hObject,'string'); axes(handles.axes2); switch str
case'×î½üÁÚ²åÖµ' T=getimage;
prompt={'ÊäÈë²ÎÊý:'}; defans={'2'};
15 / 52
p=inputdlg(prompt,'input',1,defans); p1=str2num(p{1});
f=imresize(handles.img,p1,'nearest'); imshow(f); handles.img=f;
guidata(hObject,handles);
case'Ë«ÏßÐÔ²åÖµ' T=getimage;
prompt={'ÊäÈë²ÎÊý:'}; defans={'1'};
p=inputdlg(prompt,'input',1,defans); p1=str2num(p{1});
f=imresize(handles.img,p1,'bilinear'); imshow(f); handles.img=f;
guidata(hObject,handles); end
4.7ͼÏñÖ±·½Í¼Í³¼ÆºÍÖ±·½Í¼¾ùºâ¡£
£¨1£©Í¨¹ýhisteq£¨X£©º¯ÊýʵÏÖÖ±·½Í¼¾ùºâ¡£
ÒòΪ´Ëº¯ÊýÖ»ÄܶԻҶÈͼÏñ½øÐÐÖ±·½Í¼¾ùºâ¡£¹ÊÓ¦ÏȽ«²ÊͼתΪ»Ò¶ÈͼÏñ¡£
16 / 52