Document-Boundary-Detection icon indicating copy to clipboard operation
Document-Boundary-Detection copied to clipboard

Won't run

Open dacrypt opened this issue 3 years ago • 4 comments

python3 scan.py -i Samples/2.png
STEP 1: Edge Detection
Traceback (most recent call last):
  File "scan.py", line 57, in <module>
    cnts = sorted(cnts, key = cv2.contourArea, reverse = True)[:5]
cv2.error: OpenCV(4.5.2) /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-req-build-k95y01np/opencv/modules/imgproc/src/shapedescr.cpp:315: error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function 'contourArea'

dacrypt avatar May 16 '21 00:05 dacrypt

i'm encountering this too on Fedora 31 +1

eliaspn avatar May 28 '21 12:05 eliaspn

i went back to v3.4.3.18 of opencv-python and it works, it's running :D

eliaspn avatar May 31 '21 06:05 eliaspn

cnts = cnts[0]

instead of

cnts = cnts[0] if imutils.is_cv2() else cnts[1]

if you want to use OpenCV 4+

alexgg94 avatar Oct 18 '21 19:10 alexgg94

cnts = cnts[0]

instead of

cnts = cnts[0] if imutils.is_cv2() else cnts[1]

if you want to use OpenCV 4+

https://stackoverflow.com/a/54734716/14875035

disjustin avatar Dec 09 '22 02:12 disjustin