📄 suzy_080505_1.m
字号:
function BTN_BHQZ_Callback(hObject, eventdata, handles)
% hObject handle to BTN_BHQZ (see GCBO)
% 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 BTN_BHQZ
%C边缘检测开始
global im
%BW=edge(rgb2gray(im),'soble');
%axes(handles.axes7);
%imagesc(BW)
%str=get(hObject,'string');
%axes(handles.axes7);
%switch str
% case'soble边缘检测'
% BW=edge(rgb2gray(im),'soble');
% imagesc(BW);
%
% I = imread('rgb2gray(im)');
% BW1 = edge(I,'prewitt');
% BW2 = edge(I,'canny');
% imagesc(BW1);
% figure, imagesc(BW2)
%以上病害去噪★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
%以下11★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes on button press in radiobutton7.
function radiobutton7_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton7 (see GCBO)
% 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 radiobutton7
%二值化
imm=getappdata(gcf,'A');
im=getappdata(gcf,'B');
str=getappdata(gcf,'C'); %读取上一步保存
level=graythresh(im); %灰度均值
BW=im2bw(im,level); %二值化
B = medfilt2(BW,[8 8]);
axes(handles.axes4);
imshow(B);
imwrite(B,'lvbo.bmp','bmp'); %自动保存处理图像
setappdata(gcf,'D',B); %保存处理的变量
%以上11★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%以下BACK结果计算按钮★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes during object creation, after setting all properties.
function BACK_JGJS_CreateFcn(hObject, eventdata, handles)
% hObject handle to BACK_JGJS (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
%以上BACK结果计算按钮★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
%以下求像素★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes on button press in radiobutton8.
function BTN_YXXS_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton8 (see GCBO)
% 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 radiobutton8
%回调函数
global imm
global tthh
im=imm;
[m,n]=size(im);
h=waitbar(0,'正在有效像素点总数,请稍等...'); %进度条
for i=1:0.1:200
waitbar(i/50,h)
end
close(h) %进度条
pix=0;
for i=1:m
for j=1:n
if im(i,j)>110&im(i,j)<180
pix=pix+1;
end
end
end
set(handles.edit1,'String',pix);
guidata(hObject, handles);
title('有效像素点总数')
%以上求像素★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
%以下求面积★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes on button press in BTN_QYMJ.
function BTN_QYMJ_Callback(hObject, eventdata, handles)
% hObject handle to BTN_QYMJ (see GCBO)
% 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 BTN_QYMJ
%
% global im
% str=rgb2gray(im);
% [m,n]=size(str);
% str=double(str);
% num=0;
% for i=1:m
% for j=1:n
% if str(i,j)< &str(i,j)>
% num=num+1;
% end
% end
% end
% area=((m*n)/num)*1;
%回调函数求面积
global imm
im=imm;
str=rgb2gray(im);
[m,n]=size(str);
str=double(str);
h=waitbar(0,'正在计算面积,请稍等...'); %进度条
for i=1:0.05:200
waitbar(i/50,h)
end
close(h) %进度条
pix1=0;
pix2=0;
for i=1:m
for j=1:n
if str(i,j)>225
pix2=pix2+1;
else
if str(i,j)>110&str(i,j)<180
pix1=pix1+1;
end
end
end
end
area=((pix1)/pix2);
set(handles.edit1,'String',area);
guidata(hObject, handles);
%以上面积★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%以下BACK系统退出★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes during object creation, after setting all properties.
function BACK_XTTC_CreateFcn(hObject, eventdata, handles)
% hObject handle to BACK_XTTC (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
%以上BACK系统退出★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
%以下保存处理后图片★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes on button press in BTN_BCTP.
function BTN_BCTP_Callback(hObject, eventdata, handles)
% hObject handle to BTN_BCTP (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%回调函数
[filename, pathname] = ...
uiputfile({'*.jpg';'*.tif';'*.gif';'*.pgm';'*.bmp';'*.*'}, 'Save imagecrop image');
% %imwrite(pathName,filename);
%[filename,pathname] = uiputfile('*.jpg','图片保存为');
if isequal([filename,pathname],[0,0])
return
%Otherwise construct the fullfilename and Check and load the file.
else
aa=strcat(pathname,filename);
%handles.axes1_ZBZ=image(surTem+surTem0706-273)
findobj(gcf,'Tag','axes2')
saveas(handles.axes2_ZBZ,aa);
end
%saveas(gca,'sss.bmp')
%[FileName,PathName] = uiputfile('*.jpg');
% print -dmeta strcat(PathName,FileName);
%imwrite (h,map, 'filename.bmp','bmp')
%以上保存图片★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
%以下打印图片★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes on button press in BTN_DYTP.
function BTN_DYTP_Callback(hObject, eventdata, handles)
% hObject handle to BTN_DYTP (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%回调函数
%set(gcf,'InvertHardCopy','off')
print [filename]_options
%以上打印图片★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
%以下退出系统开始★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes on button press in BTN_TCXT.
function BTN_TCXT_Callback(hObject, eventdata, handles)
% hObject handle to BTN_TCXT (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%回调函数
selection = questdlg(['Exit ' get(handles.figure1,'Name') '?'],...
['Exit ' get(handles.figure1,'Name') '...'],...
'Yes','No','Yes');
if strcmp(selection,'No')
return;
end
delete(handles.figure1)
% clc
% BTN_QCTX
% close(gcf)
%以上退出系统结束★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
%以下edit1_MJ显示计算结果★★★★★★★★★★★★★★★★★★★★★★★★★★★
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit 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
%以上edit1_MJ显示计算结果★★★★★★★★★★★★★★★★★★★★★★★★★★★
%以下坐标轴axes1_ZBZ显示原始图片★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes during object creation, after setting all properties.
function axes1_ZBZ_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes1_ZBZ (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes1_ZBZ
% imshow(I_Filter1);
%以上坐标轴axes1_ZBZ显示原始图片★★★★★★★★★★★★★★★★★★★★★★★★
%以下坐标轴axes2_ZBZ显示分割图片★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes during object creation, after setting all properties.
function axes2_ZBZ_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes2_ZBZ (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes2_ZBZ
%以上坐标轴axes2_ZBZ显示分割图片★★★★★★★★★★★★★★★★★★★★★★★★
%以下坐标轴axes3_显示★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes during object creation, after setting all properties.
function axes3__CreateFcn(hObject, eventdata, handles)
% hObject handle to axes3_ (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes3_
%以上坐标轴axes3_显示★★★★★★★★★★★★★★★★★★★★★★★★
%以下坐标轴axes4_显示★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes during object creation, after setting all properties.
function axes4__CreateFcn(hObject, eventdata, handles)
% hObject handle to axes4_ (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes4_
%以上坐标轴axes4_显示★★★★★★★★★★★★★★★★★★★★★★★★
%以下坐标轴axes5_显示★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes during object creation, after setting all properties.
function axes5__CreateFcn(hObject, eventdata, handles)
% hObject handle to axes5_ (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes5_
%以上坐标轴axes5_显示★★★★★★★★★★★★★★★★★★★★★★★★
% --- Executes during object creation, after setting all properties.
function axes4_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -