Doubt in loop : for face in faces:

in every iteration of while loop, 1 face will be added to ‘faces’ if i’m not wrong. My doubt is why are we iterating over all the faces in faces in every iteration of while loop to draw a rectangle over them. shouldn’t we just grab the latest face added and draw the rectangle over it? by doing something like
faces[-1] = faceCascade . detectMultiScale( )

please tell me if im wrong and make me understand whats happening after we have read a frame in while loop.

hey @muditarya31 ,
its totally up to you whether you want to draw bounding boxes on all faces present in the picture or you just need one.
There is no restriction as such to do so. It just depends on the task you need to do.

I hope this would have cleared your doubt.

Thank You and Happy Learning :slightly_smiling_face:.

1 Like