MATLAB(GUI)数字图像处理实验报告

发布时间 : 星期五 文章MATLAB(GUI)数字图像处理实验报告更新完毕开始阅读

imshow(GP); handles.img=GP; else

g1=g;

g2=imfilter(g1,h); g3=imadd(g2,g1); imshow(g3); handles.img=g3; end

guidata(hObject,handles);

% --- Executes on selection change in popupmenu5.

function popupmenu5_Callback(hObject, eventdata, handles) % hObject handle to popupmenu5 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu5 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu5

% --- Executes during object creation, after setting all properties. function popupmenu5_CreateFcn(hObject, eventdata, handles) % hObject handle to popupmenu5 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

% --- Executes on selection change in popupmenu6.

function popupmenu6_Callback(hObject, eventdata, handles) % hObject handle to popupmenu6 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu6 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu6

% --- Executes during object creation, after setting all properties. function popupmenu6_CreateFcn(hObject, eventdata, handles) % hObject handle to popupmenu6 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

% --- Executes on button press in pushbutton10.

function pushbutton10_Callback(hObject, eventdata, handles) %检测

% hObject handle to pushbutton10 (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(handles.popupmenu4,'value'); axes(handles.axes2);

if numel(size(handles.img))>2 I=handles.img; switch str case 1

T=handles.img; img=I;

[x y z]=size(img); if z==1

rslt=edge(img,'Roberts'); elseif z==3

img1=rgb2ycbcr(img);

dx1=edge(img1(:,:,1),'Roberts'); dx1=(dx1*255); img2(:,:,1)=dx1;

img2(:,:,2)=img1(:,:,2); img2(:,:,3)=img1(:,:,3);

rslt=ycbcr2rgb(uint8(img2)); end

imshow(rslt); handles.img=rslt;

guidata(hObject,handles); case 2

T=handles.img; img=I;

[x y z]=size(img); if z==1

rslt=edge(img,'sobel'); elseif z==3

img1=rgb2ycbcr(img);

dx1=edge(img1(:,:,1),'sobel'); dx1=(dx1*255); img2(:,:,1)=dx1;

img2(:,:,2)=img1(:,:,2); img2(:,:,3)=img1(:,:,3);

rslt=ycbcr2rgb(uint8(img2)); end

imshow(rslt); handles.img=rslt;

guidata(hObject,handles); case 3

T=handles.img; img=I;

[x y z]=size(img); if z==1

rslt=edge(img,'Prewitt'); elseif z==3

img1=rgb2ycbcr(img);

dx1=edge(img1(:,:,1),'Prewitt'); dx1=(dx1*255); img2(:,:,1)=dx1;

img2(:,:,2)=img1(:,:,2); img2(:,:,3)=img1(:,:,3);

rslt=ycbcr2rgb(uint8(img2)); end

imshow(rslt); handles.img=rslt;

guidata(hObject,handles); case 4

T=handles.img; img=I;

[x y z]=size(img); if z==1

rslt=edge(img,'log'); elseif z==3

img1=rgb2ycbcr(img);

dx1=edge(img1(:,:,1),'log');

dx1=(dx1*255); img2(:,:,1)=dx1;

img2(:,:,2)=img1(:,:,2); img2(:,:,3)=img1(:,:,3);

rslt=ycbcr2rgb(uint8(img2)); end

imshow(rslt); handles.img=rslt;

guidata(hObject,handles); case 5

T=handles.img; img=I;

[x y z]=size(img); if z==1

rslt=edge(img,'canny'); elseif z==3

img1=rgb2ycbcr(img);

dx1=edge(img1(:,:,1),'canny'); dx1=(dx1*255); img2(:,:,1)=dx1;

img2(:,:,2)=img1(:,:,2); img2(:,:,3)=img1(:,:,3);

rslt=ycbcr2rgb(uint8(img2)); end

imshow(rslt); handles.img=rslt;

guidata(hObject,handles); end else

g1=handles.img; switch str case 1

T=handles.img;

g2=edge(g1,'Roberts'); imshow(g2); handles.img=g2;

guidata(hObject,handles); case 2

T=handles.img; g2=edge(g1,'sobel'); imshow(g2); handles.img=g2;

guidata(hObject,handles); case 3

联系合同范文客服:xxxxx#qq.com(#替换为@)