Document-Boundary-Detection
Document-Boundary-Detection copied to clipboard
Won't run
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'
i'm encountering this too on Fedora 31 +1
i went back to v3.4.3.18 of opencv-python and it works, it's running :D
cnts = cnts[0]
instead of
cnts = cnts[0] if imutils.is_cv2() else cnts[1]
if you want to use OpenCV 4+
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