我是初学者,在使用Python OpenCV时遇到错误。
我的代码:
import cv2
import numpy as np
front_cascade = cv2.CascadeClassifier('../haarcascade_frontalface_default.xml')
img = cv2.imread('mimika-1024x572.jpg')
faces = front_cascade.detectMultiScale(
scaleFactor=1.1,
minNeighbors=5,
minsize=(30,30)
)
#for (x, y, w, h) in faces:
# cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 155), 3)
print (faces)
cv2.imshow('frame', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
错误:
Traceback (most recent call last):
File "C:/cv/test2.py", line 12, in <module>
minsize=(30,30)
TypeError: Required argument 'image' (pos 1) not found
如何解决此错误?
答案 0 :(得分:1)
.techStack {
grid-row: 6 / 7;
grid-column: 2 / 3;
background: bisque; }
需要一个图像作为第一个参数,但你忘了传递它。
尝试:
detectMultiScale