1 简介

给出一种基于多通道Gabor滤波技术实现高速实时布匹瑕疵检测方法.在多分辨率和多方向上分别对图像进行Gabor滤波,建立金字塔图像表示结构,并对滤波后的多幅图像进行融合与重建,把瑕疵区域从布匹背景中提取出来,从而实现对布匹瑕疵的实时检测.实验表明,这种方法的检测准确率可达到95%,而且具有计算量小、稳定性好等优点.

【图像检测】基于gabor滤波实现布匹瑕疵检测matlab代码_sed

【图像检测】基于gabor滤波实现布匹瑕疵检测matlab代码_多分辨率_02

2 部分代码

function varargout = bupi(varargin)
% BUPI MATLAB code for bupi.fig
%     BUPI, by itself, creates a new BUPI or raises the existing
%     singleton*.
%
%     H = BUPI returns the handle to a new BUPI or the handle to
%     the existing singleton*.
%
%     BUPI('CALLBACK',hObject,eventData,handles,...) calls the local
%     function named CALLBACK in BUPI.M with the given input arguments.
%
%     BUPI('Property','Value',...) creates a new BUPI or raises the
%     existing singleton*. Starting from the left, property value pairs are
%     applied to the GUI before bupi_OpeningFcn gets called. An
%     unrecognized property name or invalid value makes property application
%     stop. All inputs are passed to bupi_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 bupi
% Last Modified by GUIDE v2.5 28-May-2015 22:11:59
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
'gui_Singleton',  gui_Singleton, ...
'gui_OpeningFcn', @bupi_OpeningFcn, ...
'gui_OutputFcn',  @bupi_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 bupi is made visible.
function bupi_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 bupi (see VARARGIN)
axes(handles.axes1);
imshow([255]);
axes(handles.axes2);
imshow([255]);
axes(handles.axes3);
imshow([255]);
axes(handles.axes4);
imshow([255]);
axes(handles.axes5);
imshow([255]);
axes(handles.axes6);
imshow([255]);
% Choose default command line output for bupi
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes bupi wait for user response (see UIRESUME)
% uiwait(handles.figure1);
imshow(Ibw);
title('检测结果');
[L,m]=bwlabel(Ibw,8);
if m>=1
set(handles.text2,'String','有缺陷');
else
set(handles.text2,'String','没有缺陷');
end
% hObject   handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
axes(handles.axes1);
imshow([255]);
axes(handles.axes2);
imshow([255]);
axes(handles.axes3);
imshow([255]);
axes(handles.axes4);
imshow([255]);
axes(handles.axes5);
imshow([255]);
axes(handles.axes6);
imshow([255]);
set(handles.text2,'String','');
% hObject   handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)

3 仿真结果

【图像检测】基于gabor滤波实现布匹瑕疵检测matlab代码_sed_03

4 参考文献

[1]肖乐等. "基于Gabor滤波器的布匹瑕疵自动检测方法." 北京理工大学学报 6(2002).

【图像检测】基于gabor滤波实现布匹瑕疵检测matlab代码_ide_04