The img_gray is the grayscale input image, scaleFactor specifies how much the image size is reduced at each image scale, and minNeighbors specifies how many neighbors each candidate rectangle should have to retain it. ![]() In this method, we have passed three parameters. It returns boundary rectangles for the detected faces. The face detection is performed by detectMultiScale() function. haar_cascade_face = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') The Haar Cascade Model is a machine learning object detection algorithm used to identify objects in an image. In the following code, the function cv2.CascadeClassifier() loads the necessary XML file. img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) It specifies the type of conversion, i.e., cv2.COLOR_BGR2GRAY in the second parameter. The cvtColor() method is used to convert an image from one color-space to another. ![]() Next, we will convert the imported image in grayscale. ![]() First, we will load the image using OpenCV imread() function.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |