Ask Your Question

Revision history [back]

OpenCV cv::cvtColor Error

import cv2 import numpy as np

img = cv2.imread('yuz1.jpg')

frontal = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')

gray = cv2.cvtColor(img, cv2.COLOR_BAYER_BG2BGR)

f_face = frontal.detectMultiScale((gray, 1.1, 4))

for (x, y, w, h) in f_face: cv2.rectangle(img(x, y), (x + y + w + h), (0, 255, 0), 3)

cv2.imshow('Frontal Face', img) cv2.waitKey(0) img.release() cv2.destroyAllWindows()

@berak