-1

I am working on Google Colab, the files are on Google Drive.

The entire code

  • here in this screenshot 2nd block of code runs fine, it is getting the image file from the drive and converting it to grayscale.
  • when importing and printing the cascade clasifier it is not giving any error which means it was also successfully imported from drive
  • **but i am getting the error: (-215:Assertion failed) !empty() in function 'detectMultiScale' **

full code

import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
from google.colab.patches import cv2_imshow

# connect colab to drive and get the files
from google.colab import drive
drive.mount('/content/drive')

img = cv.imread('/content/drive/My Drive/colab/faceRecProject/me.jpg')
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)

haar_cascade = cv.CascadeClassifier('haar_face.xml') # loading the face detection classifier model
print(haar_cascade)

faces_rect = haar_cascade.detectMultiScale(gray,1.1,3)
rabeeh_ta
  • 33
  • 2
  • 5

0 Answers0