Open Momohanfeng opened 5 years ago
新手上路,有幸看到这个项目,我下载之后看了一下,发现无法运行,有两个错误 第一个: 平台:Win10 + OpenCV4.1.0+Python 3.7 步骤:点击打开相机 Log: Traceback (most recent call last): File "gesture-recognition-master0809/gesture-recognition-master/myGUI.py", line 142, in show_camera roi, res, ret, self.fourier_result, self.efd_result = pic.binaryMask(frame, x0, y0, width, height) File "gesture-recognition-master0809\gesture-recognition-master\picture.py", line 26, in binaryMask ret, fourier_result = fd.fourierDesciptor(res) File "gesture-recognition-master0809\gesture-recognition-master\fourierDescriptor.py", line 14, in fourierDesciptor contour = find_contours(Laplacian)#��ȡ���������� File "gesture-recognition-master0809\gesture-recognition-master\fourierDescriptor.py", line 31, in find_contours contour = sorted(contour, key = cv2.contourArea, reverse=True)#��һϵ�����������갴����Χ�ɵ���������������� cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\shapedescr.cpp:274: error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function 'cv::contourArea' 第二个: 平台:Win10 + OpenCV4.1.0+Python 3.7 步骤:将上述排序代码注释掉之后 ‘Traceback (most recent call last): File "gesture-recognition-master0809/gesture-recognition-master/myGUI.py", line 142, in show_camera roi, res, ret, self.fourier_result, self.efd_result = pic.binaryMask(frame, x0, y0, width, height) File "gesture-recognition-master0809\gesture-recognition-master\picture.py", line 26, in binaryMask ret, fourier_result = fd.fourierDesciptor(res) File "gesture-recognition-master0809\gesture-recognition-master\fourierDescriptor.py", line 15, in fourierDesciptor contour_array = contour[0][:, 0, :]#ע������ֻ������������������������� IndexError: too many indices for array‘
Traceback (most recent call last): File "gesture-recognition-master0809/gesture-recognition-master/myGUI.py", line 142, in show_camera roi, res, ret, self.fourier_result, self.efd_result = pic.binaryMask(frame, x0, y0, width, height) File "gesture-recognition-master0809\gesture-recognition-master\picture.py", line 26, in binaryMask ret, fourier_result = fd.fourierDesciptor(res) File "gesture-recognition-master0809\gesture-recognition-master\fourierDescriptor.py", line 14, in fourierDesciptor contour = find_contours(Laplacian)#��ȡ���������� File "gesture-recognition-master0809\gesture-recognition-master\fourierDescriptor.py", line 31, in find_contours contour = sorted(contour, key = cv2.contourArea, reverse=True)#��һϵ�����������갴����Χ�ɵ���������������� cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\shapedescr.cpp:274: error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function 'cv::contourArea'
谢谢你详细地指出问题,方便换成换成opencv3.4试试吗?我做的时候记得opencv4的findContours跟3有点区别。
好的,我试一下,然后来回复,感谢及时回复~~
新手上路,有幸看到这个项目,我下载之后看了一下,发现无法运行,有两个错误 第一个: 平台:Win10 + OpenCV4.1.0+Python 3.7 步骤:点击打开相机 Log:
Traceback (most recent call last): File "gesture-recognition-master0809/gesture-recognition-master/myGUI.py", line 142, in show_camera roi, res, ret, self.fourier_result, self.efd_result = pic.binaryMask(frame, x0, y0, width, height) File "gesture-recognition-master0809\gesture-recognition-master\picture.py", line 26, in binaryMask ret, fourier_result = fd.fourierDesciptor(res) File "gesture-recognition-master0809\gesture-recognition-master\fourierDescriptor.py", line 14, in fourierDesciptor contour = find_contours(Laplacian)#��ȡ���������� File "gesture-recognition-master0809\gesture-recognition-master\fourierDescriptor.py", line 31, in find_contours contour = sorted(contour, key = cv2.contourArea, reverse=True)#��һϵ�����������갴����Χ�ɵ���������������� cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\shapedescr.cpp:274: error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function 'cv::contourArea'
第二个: 平台:Win10 + OpenCV4.1.0+Python 3.7 步骤:将上述排序代码注释掉之后 ‘Traceback (most recent call last): File "gesture-recognition-master0809/gesture-recognition-master/myGUI.py", line 142, in show_camera roi, res, ret, self.fourier_result, self.efd_result = pic.binaryMask(frame, x0, y0, width, height) File "gesture-recognition-master0809\gesture-recognition-master\picture.py", line 26, in binaryMask ret, fourier_result = fd.fourierDesciptor(res) File "gesture-recognition-master0809\gesture-recognition-master\fourierDescriptor.py", line 15, in fourierDesciptor contour_array = contour[0][:, 0, :]#ע������ֻ������������������������� IndexError: too many indices for array‘