Home » Source Code » face_detection

face_detection

mountain
2013-12-20 06:59:20
The author
View(s):
Download(s): 3
Point (s): 2 
Category Category:
MatlabMatlab MatlabMatlab

Description

%%%%% Reading of a RGB image


i=imread('face8.jpg');
I=rgb2gray(i);
BW=im2bw(I);
figure,imshow(BW)


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% minimisation of background portion


[n1 n2]=size(BW);
r=floor(n1/10);
c=floor(n2/10);
x1=1;x2=r;
s=r*c;


for i=1:10
    y1=1;y2=c;
    for j=1:10
        if (y2<=c | y2>=9*c) | (x1==1 | x2==r*10)
            loc=find(BW(x1:x2, y1:y2)==0);
            [o p]=size(loc);
            pr=o*100/s;
            if pr<=100
                BW(x1:x2, y1:y2)=0;
                r1=x1;r2=x2;s1=y1;s2=y2;
                pr1=0;
            end
            imshow(BW);
        end
            y1=y1+c;
            y2=y2+c;
    end
    
 x1=x1+r;
 x2=x2+r;
end
 figure,imshow(BW)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% detection of face object


L = bwlabel(BW,8);
BB  = regionprops(L, 'BoundingBox');
BB1=struct2cell(BB);
BB2=cell2mat(BB1);


[s1 s2]=size(BB2);
mx=0;
for k=3:4:s2-1
    p=BB2(1,k)*BB2(1,k+1);
    if p>mx & (BB2(1,k)/BB2(1,k+1))<1.8
        mx=p;
        j=k;
    end
end
figure,imshow(I);
hold on;
rectangle('Position',[BB2(1,j-2),BB2(1,j-1),BB2(1,j),BB2(1,j+1)],'EdgeColor','r' )

Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
face8.jpg160.73 kB10-04-09 19:46
facedetection.m1.19 kB13-04-09 16:54
acd.jpg30.09 kB07-07-08 16:27
arjun3.jpg3.92 kB18-02-09 15:14
face2.jpg13.32 kB18-02-09 15:04
face3.jpg27.27 kB26-03-09 01:01
face4.jpg88.59 kB10-04-09 19:31
face5.jpg26.54 kB10-04-09 19:34
face7.jpg35.56 kB10-04-09 19:40
face8.jpg160.73 kB10-04-09 19:46
Paris2006_01.jpg51.87 kB18-02-09 15:08
priyanshu.jpg2.69 kB18-02-09 15:16
shiney.jpg2.26 kB18-02-09 15:12
Thumbs.db46.50 kB13-04-09 16:51
white4.jpg2.84 kB18-02-09 15:18
<face_database>0.00 B28-04-09 20:29
<face_detection>0.00 B28-04-09 20:30
...
Sponsored links

Comments

(Add your comment, get 0.1 Point)
Minimum:15 words, Maximum:160 words
asrorizr
2017-11-11

what method is it?

  • 1
  • Page 1
  • Total 1

face_detection (624.64 kB)

Need 2 Point(s)
Your Point (s)

Your Point isn't enough.

Get 22 Point immediately by PayPal

Point will be added to your account automatically after the transaction.

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more Points

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D