A list,

Face detection is the premise of face recognition, human-computer interaction, intelligent visual monitoring and so on. In recent years, in the field of pattern recognition and computer vision, face detection has become a popular and active research direction. In this paper, an experimental system of face detection is constructed based on the combination of skin color segmentation, template matching and candidate face image block screening, and a series of experimental statistics are carried out in this system with a self-made face image database. This paper first introduces the background and current situation of face detection technology research, expounds the significance of the development of face detection technology, summarizes some commonly used detection algorithms, and then focuses on the face detection algorithm based on skin color segmentation and template matching verification. Skin color is an important feature of human face. After sampling statistics and clustering analysis, a skin color segmentation method based on Gaussian model in YCbCr space was established. Gaussian model of skin distribution was established in YCbCr color space to obtain skin probability likelihood image, and skin region segmentation was completed under the optimal dynamic threshold selection algorithm. Mathematical morphology and some prior knowledge were used for face feature screening of skin color regions, and non-skin color regions were removed step by step to reduce the number of candidate faces and simplify the processing of subsequent detection process. This article USES the average template matching method to confirm the candidate face to face usually has a certain Angle in the image rotation and size of uncertain problems, by calculating the deflection Angle and the candidate face image block area, and to adjust the template, optimize the template matching, improve the accuracy of the template matching, at the same time avoid using multi-scale template matching algorithm for many times, Improve algorithm efficiency. The candidate face image region and template centroid are used as the origin of registration to suppress the interference of face image noise. Finally, a face detection test system based on skin color segmentation and template verification is constructed, and the system is tested with self-made face image database. Experimental results show that the system algorithm is effective and has high detection performance and low misjudgment rate.

Ii. Source code

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

% Last Modified by GUIDE v2. 5 19-May- 2020. 15:25:06

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

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

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes untitled wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from thisFunction are returned to the command line. % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- pushbutton1_Callback % - (callback function) Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)Global IM imyCBCR SKIN1 SKIN2 LPF %---------------- declared as global variable % hObject handle topushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if get (gcbo, 'Value' ) = =1;
    im=imread('10.jpg'); % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- read in color image axes (handles. Axes1)set(handles.axes1, 'XMinorTick' , 'on') %------------- embedded Axes(1) callback function imshow(im); %------------------------------ displays color imageselse
    imformats
end
% Hint: get(hObject, ' Value') returns a push the state of togglebutton1% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- pushbutton2_Callback (callback function) % - Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in afuture version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global im imycbcr skin1 skin2 lpf %------
    cr = filter2(lpf, cr) ;
    cr = reshape(cr, 1, prod(size(cr) ) ) ; bmean = mean(cb) ; % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- averaging rmean = mean (cr); brcov = cov(cb, cr) ; skin1 = zeros(dim(1) , dim(2));for i = 1: dim(1)
        for j = 1: dim(2)
            cb = double(imycbcr(i, j, 2)); cr =double(imycbcr(i, j, 3)); x =[(cb-bmean);(cr-rmean)] ; skin1(i,j) =exp(0.5*x'*inv(brcov)*x) ; % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- calculating the probability of any pixel for skin skin1 = skin1. / Max (Max (skin1)); axes(handles. axes3)set(handles. axes3, 'XMinorTick' , 'on') %------------- embedded Axes(3The callback function imshow(skin1); %------------------------------ displays skin probability imageelse
    imformats
end
% Hint: get(hObject, ' Value') returns a push the state of pushbutton3% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- pushbutton4_Callback (callback function) % - Executes on  button press in pushbutton4. function pushbutton4_Callback(hObject, eventdata, handles) % hObject handle to pushbutton4 (see GCBO) % eventdata reserved - to be defined in afuture version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global im imycbcr skin1 skin2 lpf %----------------: 0.05
        skin2 = zeros(size(skin1,1),size(skin1,2)); skin2(find(skin1>threshold)) =1; change = sum(sum(skin2 - previousSkin2) ) ; changelist = [changelist change] ; previousSkin2 = skin2; End % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- to find the best threshold [C] I = min (for changelist); optimalThreshold = (7-I) *0.1;
    skin2 = ones(size(skin1,1),size(skin1,2)); skin2(find(skin1>optimalThreshold))=0; skin2 = filter2(lpf, skin2) ; %------------------------ median axes(handles. Axes5)set(handles. axes5, 'XMinorTick'.'on') %------------- embedded Axes(4Imshow (skin2); %------------------------------ displays skin binarization imageselse
    imformats
end
% Hint: get(hObject, ' Value') returns a push the state of pushbutton4% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- pushbutton5_Callback (callback function) % - Executes on  button press in pushbutton5. function pushbutton5_Callback(hObject, eventdata, handles) % hObject handle to pushbutton5 (see GCBO) % eventdata reserved - to be defined in afuture version of MATLAB
% handles structure with handles andUser data (see GUIDATA) global IM imyCBCR SKIN1 SKIN2 LPF %---------------- declared as a global variableif get (gcbo, 'Value') = =1; sumarea = bwarea(skin2) ; %----------- calculate the total area of the object to prepare for discrimination by area [L,numobj] =bwlabel(skin2,8); avearea = sumarea/numobj; %----------- Calculate the average area of the object A = zeros(4, numobj) ; %179
    n = 1; % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- to get a pair of contains images of the region, only let other image area is black bwsegment = bwselect (skin2, y, x,8); % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - to calculate the number of segmentation block in the area of [L, numobjs] = bwlabel (bwsegment,4); % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- get the number of regional hole numfeatures = bweuler (bwsegment,4); numholes =1- numfeatures; % -------------------------------- Scan to obtain region coordinates top =- 1;
        buttom =- 1;
        left = - 1;
        right = - 1;
        dim=size(bwsegment);
        for i=1:dim(1)
            for j=1:dim(2)
                if(bwsegment(i,j) ~= 0)
                    top=i;
                    break;
                end;
            end;
            if (top ~= - 1) break; end;
        end;
Copy the code

3. Operation results

Fourth, note

Version: 2014 a