Open CV related

face_section = frame[y-offset:y+h+offset,x-offset:x+w+offset]

i don’t understand this statement.
Can we not use-
roi_gray=gray[y:y+h,x:x+w]

Also, for saving the pivture in the file, I used imwrite() . is that okay?

hey @yashikakhurana00 ,
both the commands are performing the same thing , the difference is just that they are just cropping the given area in actual frame and grayscaled frame respectively.

The frame dimensions are in the form ( y,x ) . So lets assume, a rectangular bounding box on our face with corners as A,B,C and D . So now, we have corner A = ( y ,x ) and side AB = w and AD = h , ( these are the outputs that we receive from the detectMultiScale function of cv2 )
so the coordinates of corner c will become as ( y+h , x+w ). So now we have got our rectangular bounding box with corner points A and C. Got it.
Now, just for a clear and better understanding of our face in bounding box we are enlarging our bounding box with an offset by shifting its sides with a particular value of pixels ( used as 10 pixels in lecture ) , its role is just that we are not performing a fitted crop on our face but instead we are leaving a kind of some margin between our face and bounding box.

Yeah , thats okay .Its just that , you are storing images and numpy arrays of it. So, afterwards when you are going to make face recognition model , at that time you need to convert them to .npy arrays.

I hope this would have resolved your all doubts.
Thank You and Happy Coding :slightly_smiling_face:.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.