Converting to gray

why are we using the BGR to GRAY in the gray_frame variable. why are we converting to gray.

hey @Adarsh-Bhargav-3064379896964870 ,
haarcascades works much better on gray scale images , as they are primarily created with these grayscale images only.
This is the main reason to convert images to grayscale.

Other then this , Many different openCV functions require grayscale images , as it is a 2D image and is easier to work on it for faster complex computations.

I hope this helped You :slightly_smiling_face:.