face_section = frame[y - offset : y + h + offset,x-offset : x+w+offset]
I am not able to undestsand this code.how it came
Face_section code
Consider it like this
frame is the whole photo that you clicked from your webcam
now face_section is representing the part of frame containing the face
Now our face detector gives us (x,y,h,w)
x is x_cord of the bottom left point of face
y is y_cord of the bottom left point of face
h is height , w is width
using these 4 info we can calculate the four points bounding the face
__________________
|A------------------------B|
|----------------------------|
|--------------------------- |
|----------------------------|
|C______________D|
C(x,y)
D(x+w,y)
B(x+w,y+h)
A(x,y+h)
and just for precaution that any part of face is not left out we add offset , its just like expanding the detected face frame such that no part of face is left out
1 Like