Matlab simulation of face recognition system

1. Problem description:

        Face recognition technology has broad application prospects and urgent practical needs, and it is one of the most popular research directions in the current pattern recognition, computer vision and other fields. The development of a software system for face recognition is the most important link between theory and practice. This article focuses on the background, principles and final design results of the development of the face recognition software system. Through the experiments in this article, we can know that according to the characteristics of the face skin color occupying only a small area of ​​the color area, the human face skin model is established in the HSV color model, and then the face skin image is used to train it. When the training face skin image When enough, this method can effectively detect the face area and the non-face area. This article uses 10 and 20 face skin images for training, and then detects any image. Firstly, use 10 face skin images for training, and the obtained face skin model, the result of face detection on one image is not bad, but it needs to be strengthened by training to get a better detection effect. Secondly, after training with 20 face skin images, the result of the experiment on the obtained face skin model is generally better than that of 10 images, which can abandon the burrs produced by some non-face areas, and more perfect detection. Out of the face area. The experimental results show that to obtain a more complete face skin model, it is necessary to increase the number of face skin image training, so that the training of the face skin model is gradually improved, and the face area of ​​any image can be detected. Generally speaking, the face skin model obtained after training with 100 face skin images can effectively detect any image (without other skin areas of the human body) with a detection rate of 99%. On the other hand, the experiments carried out in this article further illustrate the slowness of using the H component to change the intensity of light under the HSV color model. The model of the face skin is trained, and the obtained face skin model is slowly changed by the light. It has little effect on the results of face detection. Compared with the RGB color model which has obvious response to the brightness and darkness of light, this is a major advantage of face detection under the HSV color model based on skin color.

2. Part of the program:

 

[L,num]=bwlabeln(f,4);

for i=1:num;

    [r,c]=find(L==i);

    r_temp=max(r)-min(r);

    c_temp=max(c)-min(c);

    temp=size(r);

sum=sum+temp(1);

    area_sq=r_temp*c_temp;

    area=size(find(L==i),1);

    ratio=area/area_sq;

    if (r_temp/c_temp<0.8)|(r_temp/c_temp>2)|temp(1)>2000|temp(1)<200 |ratio<0.6

        % Face area <200 is removed , usually hands or other interference .

        % Use the approximate upper and lower limits of the face's aspect ratio to determine a template range .

        % Rectangular area s = target area length * width , the target area area is ss, if ss/s<0.6, it is not considered

        % Face area , delete it .        for j=1:temp(1);

        L(r(j),c(j))=0;

        end

    else

        continue;

    end

end

3. Simulation conclusion:

 

C-10

Guess you like

Origin blog.csdn.net/ccsss22/article/details/114895967