brielle751992346 / gesture-recognition

基于Win10 + Python3.7环境,从采集手势库开始,提取手势轮廓线,提取轮廓线的傅里叶算子作为特征,用KNN和SVM作为分类器训练模型,并用PyQt制作简易桌面
9 stars 3 forks source link

Cannot run sample #1

Open Momohanfeng opened 5 years ago

Momohanfeng commented 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‘

brielle751992346 commented 5 years ago

谢谢你详细地指出问题,方便换成换成opencv3.4试试吗?我做的时候记得opencv4的findContours跟3有点区别。

Momohanfeng commented 5 years ago

谢谢你详细地指出问题,方便换成换成opencv3.4试试吗?我做的时候记得opencv4的findContours跟3有点区别。

好的,我试一下,然后来回复,感谢及时回复~~