function varargout = jianceyuanxin(varargin)
% JIANCEYUANXIN MATLAB code for jianceyuanxin.fig
% JIANCEYUANXIN, by itself, creates a new JIANCEYUANXIN or raises the existing
% singleton*.
%
% H = JIANCEYUANXIN returns the handle to a new JIANCEYUANXIN or the handle to
% the existing singleton*.
%
% JIANCEYUANXIN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in JIANCEYUANXIN.M with the given input arguments.
%
% JIANCEYUANXIN('Property','Value',...) creates a new JIANCEYUANXIN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before jianceyuanxin_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to jianceyuanxin_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help jianceyuanxin
% Last Modified by GUIDE v2.5 28-Dec-2017 22:57:32
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @jianceyuanxin_OpeningFcn, ...
'gui_OutputFcn', @jianceyuanxin_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before jianceyuanxin is made visible.
function jianceyuanxin_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to jianceyuanxin (see VARARGIN)
% Choose default command line output for jianceyuanxin
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes jianceyuanxin wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = jianceyuanxin_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- 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 I;
[fileName,pathName] = uigetfile('*.*','Please select an image');%文件筐,选择文件
if(fileName)
fileName = strcat(pathName,fileName);
fileName = lower(fileName);%一致的小写字母形式
else
msgbox('Please select an image');
return; %退出程序
end
I = imread(fileName);% 读取原始图像;
axes(handles.axes1);
imshow(I);
% --- 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 I;
I1 = rgb2gray(I);% 对图像进行灰度化
axes(handles.axes2);
size(I1)
imshow(I1);% 显示原始图像;
th = graythresh(I1);
I1 = im2bw(I1 ,th*0.7);
I1 = ~I1;
I1=imfill(I1,'holes');% 填充图像中的空洞
r_min = 30;%检测圆最小半径;
r_max = 500;% 检测圆最大半径;
[centers,radii,metric]=imfindcircles(I1,[r_min r_max]);% 对图像进行圆形检测;
centersStrong5 = centers(1:length(metric),:)% 得到检测到的所有圆形的坐标;
radiiStrong5 = radii(1:length(metric))% 得到检测到的所有圆形的半径;
metricStrong5 = metric(1:length(metric));% 得到检测到的所有圆形的曲率;
viscircles(centersStrong5,radiiStrong5,'EdgeColor','r');% 在原始图像上用红色圆圈标识出圆形;
set(handles.edit1,'string',num2str(round(centersStrong5(3,1))))
set(handles.edit3,'string',num2str(round(centersStrong5(3,2))))
set(handles.edit4,'string',num2str(round(centersStrong5(1,1))))
set(handles.edit5,'string',num2str(round(centersStrong5(1,2))))
set(handles.edit6,'string',num2str(round(centersStrong5(2,1))))
set(handles.edit7,'string',num2str(round(centersStrong5(2,2))))
L1 = (centersStrong5(3,1) - centersStrong5(1,1))*(centersStrong5(3,1) - centersStrong5(1,1)) + (centersStrong5(3,2) - centersStrong5(1,2))*(centersStrong5(3,2) - centersStrong5(1,2))
L2 = (centersStrong5(1,1) - centersStrong5(2,1))*(centersStrong5(1,1) - centersStrong5(2,1)) + (centersStrong5(1,2) - centersStrong5(2,2))*(centersStrong5(1,2) - centersStrong5(2,2))
L1 = sqrt(L1)/8.7;
L2 = sqrt(L2)/8.7;
set(handles.edit8,'string',num2str((L1)))
set(handles.edit9,'string',num2str((L2)))
set(handles.edit10,'string',num2str(radiiStrong5(3)*2/8.7))
set(handles.edit11,'string',num2str((radiiStrong5(1)*2+14)/8.7))
set(handles.edit12,'string',num2str((radiiStrong5(2)*2+24)/8.7))
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
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (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 edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (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
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (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 edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future v
神经网络机器学习智能算法画图绘图
- 粉丝: 2809
- 资源: 659
最新资源
- nncfunction.m
- openssl1.1.0f版本
- busgame.zip
- 手腕骨折64-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord、VOC数据集合集.rar
- 代连潞个人简历.pdf
- 手脚检测23-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord、VOC数据集合集.rar
- QT实战-qt菜单样式实现、自定义带滚动条的菜单实现
- springboot-基于javaweb宿舍管理系统
- 自主注解与对比自训练: 提高多步推理代理性能的新框架
- Python代码补全中的过去经验指导方法研究
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈