I am trying to implement a simple face detection of cartoons code using opencv and python. Though the code I have used works for faces of humans I am not able to detect cartoon faces using this. Is there any way I can make it detect cartoon faces too.
import cv2
import matplotlib.pyplot as plt
imagePath = 'frame179.jpg'
cascPath = '/Users/tonystark/opencv/data/haarcascades/haarcascade_frontalface_default.xml'
faceCascade = cv2.CascadeClassifier(cascPath)
image = cv2.imread(imagePath)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.1,
minNeighbors=40,
minSize=(24, 24),
flags=cv2.CASCADE_SCALE_IMAGE
)
The images are human for which I am able to get the location of the face, whereas for cartoon, I am not able to get the location of faces.
Thanks a lot in advance !