matlab路面裂纹裂缝crack识别与测量GUI

2023-11-11 09:50

本文主要是介绍matlab路面裂纹裂缝crack识别与测量GUI,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

matlab路面裂纹裂缝crack识别与测量GUI

如需安装运行环境或远程调试,可加QQ905733049, 或QQ2945218359由专业技术人员远程协助!

运行结果如下:

代码如下:


% GUI_MAIN M-file for Gui_Main.fig
%      GUI_MAIN, by itself, creates a new GUI_MAIN or raises the existing
%      singleton*.
%
%      H = GUI_MAIN returns the handle to a new GUI_MAIN or the handle to
%      the existing singleton*.
%
%      GUI_MAIN('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in GUI_MAIN.M with the given input arguments.
%
%      GUI_MAIN('Property','Value',...) creates a new GUI_MAIN or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before Gui_Main_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to Gui_Main_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 Gui_Main% Last Modified by GUIDE v2.5 29-Mar-2011 22:28:58% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...'gui_Singleton',  gui_Singleton, ...'gui_OpeningFcn', @Gui_Main_OpeningFcn, ...'gui_OutputFcn',  @Gui_Main_OutputFcn, ...'gui_LayoutFcn',  [] , ...'gui_Callback',   []);
if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});
endif nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
elsegui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT% --- Executes just before Gui_Main is made visible.
function Gui_Main_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 Gui_Main (see VARARGIN)% Choose default command line output for Gui_Main
handles.output = hObject;
handles.Result = [];
handles.File = [];
% Update handles structure
guidata(hObject, handles);
clc; warning off all;
InitAxes(handles);% UIWAIT makes Gui_Main wait for user response (see UIRESUME)
% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.
function varargout = Gui_Main_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;axes(handles.axes1); imshow(handles.Result.Image); title('原图像');% --- Executes on button press in pushbuttonHisteq.
function pushbuttonHisteq_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonHisteq (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if ~isempty(handles.Result)axes(handles.axes1); imshow(handles.Result.Image); title('原图像');axes(handles.axes2); imshow(handles.Result.hist); title('直方图均衡化图像');
end% --- Executes on button press in pushbuttonMedfilt.
function pushbuttonMedfilt_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonMedfilt (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if ~isempty(handles.Result)axes(handles.axes1); imshow(handles.Result.Image); title('原图像');axes(handles.axes2); imshow(handles.Result.Medfilt); title('中值滤波图像');
end% --- Executes on button press in pushbuttonBw.
function pushbuttonBw_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonBw (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if ~isempty(handles.Result)axes(handles.axes1); imshow(handles.Result.Image); title('原图像');axes(handles.axes2); imshow(handles.Result.Bw); title('二值图像');
end% --- Executes on button press in pushbuttonEnance.
function pushbuttonEnance_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonEnance (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if ~isempty(handles.Result)axes(handles.axes1); imshow(handles.Result.Image); title('原图像');axes(handles.axes2); imshow(handles.Result.Enance); title('增强图像');
end% --- Executes on button press in pushbuttonBwfilter.
function pushbuttonBwfilter_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonBwfilter (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if ~isempty(handles.Result)axes(handles.axes1); imshow(handles.Result.Image); title('原图像');axes(handles.axes2); imshow(handles.Result.Bw); title('二值图像');axes(handles.axes3); imshow(handles.Result.BwFilter); title('二值图像滤波');
end% --- Executes on button press in pushbuttonCrackJudge.
function pushbuttonCrackJudge_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonCrackJudge (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if ~isempty(handles.Result)axes(handles.axes1); imshow(handles.Result.Image); title('原图像');axes(handles.axes2); imshow(handles.Result.BwFilter); title('二值图像滤波');axes(handles.axes3); imshow(handles.Result.CrackRec); title('裂缝识别');axes(handles.axes4); imshow(handles.Result.CrackJudge); title('裂缝判断');
end% --- Executes on button press in pushbuttonCrackLoc.
function pushbuttonCrackLoc_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonCrackLoc (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if ~isempty(handles.Result)axes(handles.axes1); imshow(handles.Result.Image); title('原图像');axes(handles.axes2); imshow(handles.Result.CrackJudge); title('裂缝图像');axes(handles.axes3); imshow(handles.Result.CrackJudge); title(handles.Result.str);axes(handles.axes4); imshow(handles.Result.CrackJudge); title('裂缝标记图像');hold on;rectangle('Position', handles.Result.rect, 'EdgeColor', 'g', 'LineWidth', 2);hold off;
end% --- Executes on button press in pushbuttonProject.
function pushbuttonProject_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonProject (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if ~isempty(handles.Result)axes(handles.axes1); imshow(handles.Result.Image); title('原图像');axes(handles.axes2); imshow(handles.Result.CrackJudge); title('裂缝图像');axes(handles.axes3); plot(1:size(handles.Result.Image, 1), handles.Result.Projectr);title('行投影');axes(handles.axes4); plot(1:size(handles.Result.Image, 2), handles.Result.Projectc);title('列投影');
end% --- Executes on button press in pushbuttonClose.
function pushbuttonClose_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonClose (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
choice = questdlg('确定退出?', ...'退出', ...'是','否','否');
switch choicecase '是'close;otherwisereturn;
end% --- Executes on button press in pushbuttonSaveResult.
function pushbuttonSaveResult_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonSaveResult (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
tryif ~isempty(handles.File)raw = [];xlsfile = fullfile(pwd, 'Result/result.xls');if exist(xlsfile, 'file')[num, txt, raw] = xlsread(xlsfile);endF = [];F{1, 1} = '文件名';F{1, 2} = '阈值信息';F{1, 3} = '面积信息';F{1, 4} = '长度信息';F{1, 5} = '最大宽度信息';F{1, 6} = '最小宽度信息';F{1, 7} = '形状信息';F{2, 1} = handles.File;F{2, 2} = handles.Result.BwTh;F{2, 3} = handles.Result.BwArea;F{2, 4} = handles.Result.BwLength;F{2, 5} = handles.Result.BwWidthMax;F{2, 6} = max(handles.Result.BwWidthMin,0.01);F{2, 7} = handles.Result.str;F = [raw; F];xlswrite(xlsfile, F);msgbox('保存结果成功!', '信息提示框');end
catchmsgbox('保存结果失败,请检查程序!', '信息提示框');
end% --- Executes on button press in pushbuttonBridge.
function pushbuttonBridge_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonBridge (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if ~isempty(handles.Result)axes(handles.axes1); imshow(handles.Result.Image); title('原图像');axes(handles.axes2); imshow(handles.Result.BwFilter); title('二值图像滤波');axes(handles.axes3); imshow(handles.Result.CrackJudge); title('裂缝判断');axes(handles.axes4); imshow(handles.Result.CrackBridge); title('裂缝拼接');
end% --- Executes on button press in pushbuttonDiplay.
function pushbuttonDiplay_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonDiplay (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if ~isempty(handles.File)F = [];F{1} = sprintf('文件名:%s', handles.File);F{2} = sprintf('阈值信息%.2f', handles.Result.BwTh);F{3} = sprintf('面积信息%.2f', handles.Result.BwArea);F{4} = sprintf('长度信息%.2f', handles.Result.BwLength);F{5} = sprintf('最大宽度信息%.2f', handles.Result.BwWidthMax);F{6} = sprintf('最小宽度信息%.2f', max(handles.Result.BwWidthMin,0.01));F{7} = sprintf('形状信息%s', handles.Result.str);listdlg('PromptString', '参数显示:',...'Name', '参数信息', ...'ListSize', [300, 150], ...'SelectionMode','single',...'ListString', F);
end

运行结果如下:

C++学习参考实例:

C++实现图形界面五子棋游戏源码:

https://blog.csdn.net/alicema1111/article/details/90035420

C++实现图形界面五子棋游戏源码2:

https://blog.csdn.net/alicema1111/article/details/106479579

C++ OpenCV相片视频人脸识别统计人数:

https://blog.csdn.net/alicema1111/article/details/105833928

VS2017+PCL开发环境配置:

https://blog.csdn.net/alicema1111/article/details/106877145

VS2017+Qt+PCL点云开发环境配置:

https://blog.csdn.net/alicema1111/article/details/105433636

C++ OpenCV汽车检测障碍物与测距:

https://blog.csdn.net/alicema1111/article/details/105833449

Windows VS2017安装配置PCL点云库:

https://blog.csdn.net/alicema1111/article/details/105111110

这篇关于matlab路面裂纹裂缝crack识别与测量GUI的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/389225

相关文章

Python基于微信OCR引擎实现高效图片文字识别

《Python基于微信OCR引擎实现高效图片文字识别》这篇文章主要为大家详细介绍了一款基于微信OCR引擎的图片文字识别桌面应用开发全过程,可以实现从图片拖拽识别到文字提取,感兴趣的小伙伴可以跟随小编一... 目录一、项目概述1.1 开发背景1.2 技术选型1.3 核心优势二、功能详解2.1 核心功能模块2.

Python验证码识别方式(使用pytesseract库)

《Python验证码识别方式(使用pytesseract库)》:本文主要介绍Python验证码识别方式(使用pytesseract库),具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全... 目录1、安装Tesseract-OCR2、在python中使用3、本地图片识别4、结合playwrigh

使用Python和PaddleOCR实现图文识别的代码和步骤

《使用Python和PaddleOCR实现图文识别的代码和步骤》在当今数字化时代,图文识别技术的应用越来越广泛,如文档数字化、信息提取等,PaddleOCR是百度开源的一款强大的OCR工具包,它集成了... 目录一、引言二、环境准备2.1 安装 python2.2 安装 PaddlePaddle2.3 安装

Python GUI框架中的PyQt详解

《PythonGUI框架中的PyQt详解》PyQt是Python语言中最强大且广泛应用的GUI框架之一,基于Qt库的Python绑定实现,本文将深入解析PyQt的核心模块,并通过代码示例展示其应用场... 目录一、PyQt核心模块概览二、核心模块详解与示例1. QtCore - 核心基础模块2. QtWid

使用PyTorch实现手写数字识别功能

《使用PyTorch实现手写数字识别功能》在人工智能的世界里,计算机视觉是最具魅力的领域之一,通过PyTorch这一强大的深度学习框架,我们将在经典的MNIST数据集上,见证一个神经网络从零开始学会识... 目录当计算机学会“看”数字搭建开发环境MNIST数据集解析1. 认识手写数字数据库2. 数据预处理的

Pytorch微调BERT实现命名实体识别

《Pytorch微调BERT实现命名实体识别》命名实体识别(NER)是自然语言处理(NLP)中的一项关键任务,它涉及识别和分类文本中的关键实体,BERT是一种强大的语言表示模型,在各种NLP任务中显著... 目录环境准备加载预训练BERT模型准备数据集标记与对齐微调 BERT最后总结环境准备在继续之前,确

讯飞webapi语音识别接口调用示例代码(python)

《讯飞webapi语音识别接口调用示例代码(python)》:本文主要介绍如何使用Python3调用讯飞WebAPI语音识别接口,重点解决了在处理语音识别结果时判断是否为最后一帧的问题,通过运行代... 目录前言一、环境二、引入库三、代码实例四、运行结果五、总结前言基于python3 讯飞webAPI语音

使用Python开发一个图像标注与OCR识别工具

《使用Python开发一个图像标注与OCR识别工具》:本文主要介绍一个使用Python开发的工具,允许用户在图像上进行矩形标注,使用OCR对标注区域进行文本识别,并将结果保存为Excel文件,感兴... 目录项目简介1. 图像加载与显示2. 矩形标注3. OCR识别4. 标注的保存与加载5. 裁剪与重置图像

Python爬虫selenium验证之中文识别点选+图片验证码案例(最新推荐)

《Python爬虫selenium验证之中文识别点选+图片验证码案例(最新推荐)》本文介绍了如何使用Python和Selenium结合ddddocr库实现图片验证码的识别和点击功能,感兴趣的朋友一起看... 目录1.获取图片2.目标识别3.背景坐标识别3.1 ddddocr3.2 打码平台4.坐标点击5.图

如何通过海康威视设备网络SDK进行Java二次开发摄像头车牌识别详解

《如何通过海康威视设备网络SDK进行Java二次开发摄像头车牌识别详解》:本文主要介绍如何通过海康威视设备网络SDK进行Java二次开发摄像头车牌识别的相关资料,描述了如何使用海康威视设备网络SD... 目录前言开发流程问题和解决方案dll库加载不到的问题老旧版本sdk不兼容的问题关键实现流程总结前言作为