Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
1
Hello and welcome to this new tutorial in the previous tutorial we loaded the Cascades and now that
2
we did that we were ready to define a function that will do the detections.
3
So we will make that function in two or three tutorials.
4
We will start by defining it and getting the coordinates of the rectangle that will detect the face
5
and then the eyes then we will have a for loop that will iterate through the different faces there are
6
detected in the video.
7
And so for each of these faces we will draw a rectangle indicating that's a face.
8
And also inside each of these faces we will detect some eyes.
9
So that's what this function is about.
10
And let's implement it right now to define a function in python we have to start with Teff and then
11
we need to give a name to this function we we're going to call it detect that we go detect and now we
12
need to input some arguments.
13
So since this function is going to be applied on single images and that is going to return for each
14
of these images the same image with the rectangle that is detecting the faces and the eyes.
15
Well it's going to take as inputs an image it's going to be the different images of the video coming
16
from the webcam.
17
But this function works on single images one by one.
18
So that's why we can put the video directly we have to play it on images.
19
But as you saw in the intuition lectures a cascade works on black and white image.
20
So what we need to do is first get the black and white version of the image but also the original image
21
because at the end this function will return the original image with the rectangles.
22
It will now return the image in black and white.
23
So that's why right now what we need to take as arguments is grey which is the black and white image
24
that is image and black and white and also the original frame the original image which we will call
25
frame and that's are two arguments perfekt we need to add some color now and then enter to go inside
26
the function and define what we want it to do.
27
All right.
28
So as I said at the beginning of this tutorial The first thing we need to do is get the coordinates
29
of the rectangle that will detect the face.
30
And so we're going to get some tables of four elements x y w h x and y are the coordinates of the upper
31
left corner.
32
W will be the width of the rectangle and age will be the height of the rectangle.
33
But since we're going to get several tables of these four elements Well we're going to put all these
34
troubles in a variable that we're going to call faces and we are going to get these supples things to
35
a method of the Cascade classifier class which is to detect multi-skilled method.
36
All right.
37
And in order to get this method we need to take the object of the Cascade classifier class and since
38
right now we're working with the faces we're trying to get the coordinates of the rectangles detecting
39
the faces.
40
Well we're going to get this method from Phase cascade.
41
That's our object for the face to face cascade and then dart and then that's where we can use to detect
42
multiday scale method that will get us to the coordinates of the upper left corner and the width and
43
the height of the rectangles detecting the faces.
44
So now does detect Martell's kill method takes several arguments.
45
The first one is of course the emergent like in white.
46
Because as we said Cascades work on black and white images.
47
So Gray that's the first argument and then it's going to take two other arguments which are going to
48
be first the scale factor which tells by how much the size of the image is going to be reduced or equivalently
49
by how much the size of the filter is that it's the Colonel's will be increased.
50
So that's the same and we are going to take a scaling factor of 1.3 which means that the size of the
51
image will be reduced 1.3 times and then a last argument which is the minimum number of neighbors.
52
So if you remember the intuition lectures you saw that in order for a zone of pixels to be accepted
53
we all need to have at least a certain number of neighbor zones that are also accepted and that certain
54
number is exactly the minimum number that we're going to input right now.
55
And that is going to be five.
56
So that means that in order for a zone of pixels to be accepted one at least five neighbor zones must
57
also be accepted.
58
So that's what this is about.
59
And so now I suspect some of you will ask why 1.3 and five.
60
Well the reason is that we get some really good results with these numbers and that's why we're getting
61
them.
62
But of course that's due to experience we experience them and it turns out that 1.3 in five is a good
63
combo to detect some faces with the web cam.
64
All right so there we go.
65
We have our faces so as a reminder faces our troubles of four elements x and y which are ordinated the
66
upper left corner of the rectangle that will detect the face and W and age which are respectively the
67
width and height of these rectangles.
68
Perfect.
69
So now we're going to start a full loop and actually we're going to iterate through the different faces
70
because we have several tables and for each of these faces we will draw the rectangle and inside these
71
rectangles will detect some eyes but we'll do that in the next tutorial.
72
So until then enjoy computer vision.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.