Value errors when running cell 3
baohuypham opened this issue · 1 comments
Hi Vivek,
I'm new to the program and really wanted to use this for a research project. I'm on a mac and trying to use Tracktor on the fish video, but every time I run cell 3, I got this message about some value errors. Here it is.
ValueError Traceback (most recent call last)
in
25 frame = cv2.resize(frame, None, fx = scaling, fy = scaling, interpolation = cv2.INTER_LINEAR)
26 thresh = tr.colour_to_thresh(frame, block_size, offset)
---> 27 final, contours, meas_last, meas_now = tr.detect_and_draw_contours(frame, thresh, meas_last, meas_now, min_area, max_area)
28 row_ind, col_ind = tr.hungarian_algorithm(meas_last, meas_now)
29 final, meas_now, df = tr.reorder_and_draw(final, colours, n_inds, col_ind, meas_now, df, mot, this)
~/Desktop/tracktor-master/examples/tracktor.py in detect_and_draw_contours(frame, thresh, meas_last, meas_now, min_area, max_area)
65 """
66 # Detect contours and draw them based on specified area thresholds
---> 67 img, contours, hierarchy = cv2.findContours(thresh.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
68 img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
69
ValueError: not enough values to unpack (expected 3, got 2)
I'm not sure where this problem comes from and how to fix it. I've installed all the necessary packages and updated Python to the 3.7 version.
I would really appreciate if you took a look at this and maybe gave me some suggestion.
Thanks
Huy
Dear Huy,
This error comes because OpenCV changed the return for the findContours function. I have now implemented this change in the tracktor.py file. If you download this again from the github page, things should start working. Let me know if this solved your problem. :)
Cheers!
Vivek