You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I just submitted a pr, and the robot reports errors on modules/python/test/test_facedetect.py*, as
Traceback (most recent call last):
File "/build/precommit_linux64/opencv/modules/python/test/test_facedetect.py", line 55, in test_facedetect
rects = detect(gray, cascade)
File "/build/precommit_linux64/opencv/modules/python/test/test_facedetect.py", line 18, in detect
rects[:,2:] += rects[:,:2]
TypeError: list indices must be integers or slices, not tuple
Since the C++ version of this code provides vector, the python version should return LIST OF TUPLES instead of NUMPY 2D ARRAY as above, which satisfy the consistency of vector convertion between Python and C as well.
Tuples are almost not usable for future processing (including math-based), so we using np.array instead of tuples whenever possible.
So we don't asking users to do this: rects = np.array(rects)
However, the reverse conversion(numpy array to vector) doesn't work well(pyopencv_to). In this issue, after my final pr the original code still fails because of python binding:
terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.1.0-pre) /home/tegusi/opencv-master/modules/core/src/copy.cpp:254: error: (-215:Assertion failed) channels() == CV_MAT_CN(dtype) in function 'copyTo'
Hello! I just submitted a pr, and the robot reports errors on modules/python/test/test_facedetect.py*, as
and the source file is
opencv/modules/python/test/test_facedetect.py
Lines 13 to 19 in 360758e
Since the C++ version of this code provides vector, the python version should return LIST OF TUPLES instead of NUMPY 2D ARRAY as above, which satisfy the consistency of vector convertion between Python and C as well.
opencv/modules/objdetect/src/cascadedetect.cpp
Lines 1351 to 1356 in 360758e
Which can be fixed by convert it to numpy array
rects = np.array(rects)
System information (version)
Detailed description
Steps to reproduce
The text was updated successfully, but these errors were encountered: