[crack identification] pavement crack identification system based on GUI BP neural network [Matlab 1063]

Posted by gassaz on Fri, 17 Dec 2021 05:02:01 +0100

1, Introduction

The detection of pavement cracks is an important part of expressway pavement disease maintenance and management. In recent years, pavement crack automatic detection technology has been widely used. Due to the complexity of pavement crack image, the detection algorithm directly affects the accuracy of detection results. Therefore, this paper will focus on the detection of pavement crack diseases. In order to improve the detection accuracy, this paper makes an in-depth study from the aspects of crack image denoising, image enhancement, image segmentation and feature extraction of pavement crack image after detection. In the pavement crack image, it is difficult to detect the crack directly because the contrast between the crack information and the background is low. For image preprocessing, firstly, the gray level of the image is corrected, and then the corrected image is filtered. This paper proposes an improved median filtering method to denoise the image, and then further enhance the image with the image enhancement principle based on fuzzy theory, which effectively improves the contrast of pavement crack image. For the pavement crack image segmentation, this paper uses the threshold segmentation and the idea based on morphological multi-scale respectively. For the crack with regular shape, the threshold segmentation is used. For the image with irregular crack shape, this paper designs an anti noise edge detection operator with multiple structural elements, and the probability of filling the crack edge is different according to the structural elements with different shapes, The adaptive weight is determined, so that the operator can detect various types of crack edges, which effectively improves the detection accuracy. For the problems of noise and crack fracture in the segmented pavement crack image, this paper uses the closed operation and open operation in morphology to process the image with narrow fracture, and proposes a connection method of fracture block based on growth for the image with wide fracture. The efficiency and accuracy of the connection are improved, and the whole detection result is clear and complete. Finally, the crack information is extracted from the recognition result map. According to the obtained recognition result diagram, set a series of judgment conditions, extract the connected region of the fracture, judge the type of the fracture, and finally calculate the area of the network fracture and the length and width information of the linear fracture.

2, Source code

function varargout = firstPage(varargin)
% FIRSTPAGE MATLAB code for firstPage.fig
%      FIRSTPAGE, by itself, creates a new FIRSTPAGE or raises the existing
%      singleton*.
%
%      H = FIRSTPAGE returns the handle to a new FIRSTPAGE or the handle to
%      the existing singleton*.
%
%      FIRSTPAGE('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in FIRSTPAGE.M with the given input arguments.
%
%      FIRSTPAGE('Property','Value',...) creates a new FIRSTPAGE or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before firstPage_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to firstPage_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 firstPage

% Last Modified by GUIDE v2.5 12-Apr-2021 10:23:22

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @firstPage_OpeningFcn, ...
                   'gui_OutputFcn',  @firstPage_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 firstPage is made visible.
function firstPage_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 firstPage (see VARARGIN)

% Choose default command line output for firstPage
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);
% set(gcf,'menu','figure');
set(gcf,'numbertitle','off','name','be based on BP The software of pavement crack detection and treatment based on Neural Network');
% UIWAIT makes firstPage wait for user response (see UIRESUME)
% uiwait(handles.figure1);
bg_P=axes('units','normalized','position',[0 0 1 1]);
uistack(bg_P,'bottom');
II=imread('background\8.jpg');
image(II);
hold on 
%  w=text(177,68,'be based on BP Pavement crack treatment system based on Network','fontsize',25,'color',[1.0 1.0 1.0]);
  w=text(65,98,'be based on BP The software of pavement crack detection and treatment based on Neural Network','fontsize',25,'color',[0.0 0.0 0.0]);
   w1=text(52,150,'Pavement Crack Detection And Processing Suggest Software ','fontsize',20,'color',[0.0 0.0 0.0]);
   w2=text(250,200,'Based On BP Neural Network ','fontsize',20,'color',[0.0 0.0 0.0]);
    w3=text(385,400,'university','fontsize',15,'color',[0.0 0.0 0.0]);
    w4=text(340,420,'** University ','fontsize',13,'color',[0.0 0.0 0.0]);
     w5=text(380,470,'1st,April,2021','fontsize',11,'color',[0.0 0.0 0.0]);
   
   
colormap gray;
set(bg_P,'handlevisibility','off','visible','off');

% set(handles.pushbutton1,'visible','off');
% --- Outputs from this function are returned to the command line.
function varargout = firstPage_OutputFcn(~, 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 model_Callback(hObject, eventdata, handles)
% hObject    handle to model (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Help_Callback(hObject, eventdata, handles)
% hObject    handle to Help (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Exit_Callback(hObject, eventdata, handles)
% hObject    handle to Exit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
close gcf;

% --------------------------------------------------------------------
function fast_Callback(hObject, eventdata, handles)      %%%%%%%%%%%%%%%%%%%%%%%%%%%Mode selection--->Quick mode



% --------------------------------------------------------------------
function Retrain_Callback(hObject, eventdata, handles)                     %%%%%%%%%%%%%%%%%%%%%Mode selection--->Retraining
ANNcheck;
load data\acy_check;
load data\acy_reg;
t=['The accuracy is' acy_check];
q=questdlg(t,'Retraining','yes','no','no');
if q=='yes'
    Retrain_Callback();
else
    setappdata(0,'acy_check',acy_check);
    setappdata(0,'acy_reg',acy_reg);
    close(gcf);
    secondPage;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%As retraining or Quick mode flag
Hit=0;
setappdata(0,'Hit',Hit);                                                     %%%%%%%Retraining mode, then Hit=0

% --------------------------------------------------------------------
function ask_help_Callback(hObject, eventdata, handles)
% hObject    handle to ask_help (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
open ('Help.docx');


% --------------------------------------------------------------------
function Wenjian_Callback(hObject, eventdata, handles)
% hObject    handle to Wenjian (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function file_in_Callback(hObject, eventdata, handles)
% hObject    handle to file_in (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
open txt\Introduction to procedure documents.txt

% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)
% hObject    handle to Exit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function DingYi_Callback(hObject, eventdata, handles)
% hObject    handle to DingYi (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
open txt\Definition of crack direction.txt


% --------------------------------------------------------------------
function Net_Callback(hObject, eventdata, handles)
% hObject    handle to Net (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function CheckNet_Callback(hObject, eventdata, handles)                    %%%%%%%%%%%%%%%%%About network->Detection network
% hObject    handle to CheckNet (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
open txt\Detection network.txt;

% --------------------------------------------------------------------
function RecNet_Callback(hObject, eventdata, handles)                     %%%%%%%%%%%%%%%%%About network->Identification network
% hObject    handle to RecNet (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
open txt\Identification network.txt;

% --------------------------------------------------------------------
function retrain_c_Callback(hObject, eventdata, handles)
% hObject    handle to retrain_c (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function retrain_r_Callback(hObject, eventdata, handles)
% hObject    handle to retrain_r (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Reset_Callback(hObject, eventdata, handles)                       %%%%%%%%%%%%%%Parameter Reset 
% hObject    handle to Reset (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
tex=['The default parameter is the best combination obtained through many experiments. Do you really need to reset it?'];
q=questdlg(tex,'reminder','yes','no','no');
if q=='yes'      
    t{1}='Maximum number of iterations';t{2}='Number of hidden elements in the first hidden layer';t{3}='Number of hidden elements in the second hidden layer';
    t{4}='First hidden layer activation function';t{5}='Second hidden layer activation function';t{6}='Training function';
    title='set up';
    default_t={'5000','432','54','tansig','purelin','trainscg'};
    param=inputdlg(t,title,1,default_t,'on');
    num1=str2num(param{1});num2=str2num(param{2});num3=str2num(param{3});
    str1=(param{4});str2=(param{5});str3=(param{6});
    
    save data\param num1 num2 num3 str1 str2 str3;
    key_reset=1;
    save data\key_reset key_reset;
else
    key_reset=0;
    save data\key_reset key_reset;
    
end
    



% --------------------------------------------------------------------
function f_open_Callback(hObject, eventdata, handles)
% hObject    handle to f_open (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[filename pathname]=uigetfile({'*.jpg';'*.png';'*.gif'},'Select background');

% --------------------------------------------------------------------
function f_new_Callback(hObject, eventdata, handles)
% hObject    handle to f_new (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

3, Operation results


4, matlab version and references

1 matlab version
2014a

2 references
[1] Cai Limei MATLAB image processing -- theory, algorithm and example analysis [M] Tsinghua University Press, 2020
[2] Yang Dan, Zhao Haibin, long Zhe Detailed explanation of MATLAB image processing example [M] Tsinghua University Press, 2013
[3] Zhou pin MATLAB image processing and graphical user interface design [M] Tsinghua University Press, 2013
[4] Liu Chenglong Proficient in MATLAB image processing [M] Tsinghua University Press, 2015

Topics: MATLAB neural networks Deep Learning image processing