I am not able to print the face coordinates and getting errors
The code works fine till that line. I tried fixing it in many ways like using location instead of the name of the picture.
import cv2
trained_face_data= cv2.CascadeClassifier('haarcascade_frontface_default.xml')
# the source pic
img=cv2.imread('D:\\opencv\\CUTE 2.png')
#img=cv2.imread('CUTE 2.png')
#convert to gray
Gray_img= cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
face_coordinates = trained_face_data.detectMultiScale(Gray_img)
#showng an image
#cv2.imshow('Clever Programmer Face Detector', Gray_img)
print(face_coordinates)
# wait to excute
cv2.waitKey()
the Erroe message is cv2.error: OpenCV(4.5.3) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-sn_xpupm\opencv\modules\objdetect\src\cascadedetect.cpp:1689: error: (-215:Assertion failed) !empty() in function 'cv::CascadeClassifier::detectMultiScale'
What is the cause of the error?