I am trying to implement contours using the following code..
im = cv2.imread(\'C:\\Users\\Prashant\\Desktop\\T.jpg\')
imgray = cv2.cvtColor(im,cv2.COLOR_BGR2
Python version 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)]
NumPy version: 1.16.1
argparse version: 1.1
CV2 version: 4.0.0
Traceback (most recent call last):
File "omr.py", line 254, in
main()
File "omr.py", line 237, in main
answers, im = get_answers(args.input)
File "omr.py", line 188, in get_answers
contours = get_contours(im)
File "omr.py", line 26, in get_contours
im2, contours, hierarchy =cv2.findContours(image_gray,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
ValueError: need more than 2 values to unpack
This is resolved by removing 'im2 ,' from line 26.. as in OpenCv version 3.0 or higher, the function 'findContours' returns only 2 values.. so the statement should be
contours, hierarchy =cv2.findContours(image_gray,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
and also upgrade your OpenCv version