for root, dirs, files in os.walk('c:\images'):
for fname in files:
img = cv2.imread(fname)
cv2.resize(img, None, fx=0.4, fy=0.3, interpolation=cv2.INTER_AREA)
eyes = eye_cascade.detectMultiScale(img, 1.1, 5)
faces = face_cascade.detectMultiScale(img, 1.2, 5)
noses = nose_cascade.detectMultiScale(img, 1.1, 5)
mouths = mouth_cascade.detectMultiScale(img, 1.1, 5)
OpenCV Error: Assertion failed (ssize.area() > 0) in cv::resize, file ..\..\..\..\opencv\modules\imgproc\src\imgwarp.cpp, line 1968
Traceback (most recent call last):
File "C:/FaceDetWeightSave.py", line 19, in <module>
cv2.resize(img, None, fx=0.4, fy=0.3, interpolation=cv2.INTER_AREA)
cv2.error: ..\..\..\..\opencv\modules\imgproc\src\imgwarp.cpp:1968: error: (-215) ssize.area() > 0 in function cv::resize
我認爲,這個錯誤是從os.walk(for root, dirs, files <- this)
。我如何檢測文件?
啊,你的形象似乎是空的。是否有細分人員(例如,每個人)? – berak 2014-11-22 10:36:14
我很抱歉,但我不知道'subdir'< - 是它的子目錄嗎? – 2014-11-22 10:57:18
是的,我的意思是像c:/images/person1/img_003.png – berak 2014-11-22 11:03:24