JeVois using GRIP to generate Python OpenCV - Issues with __FindContours

opencv
python
jevois

#1

We are using this tutorial to set up JeVois using GRIP

https://github.com/asid61/JeVois-For-FRC/blob/master/The%20Design%20Simple%20Guide%20to%20JeVois.pdf

When we copy our GRIP constants over to PythonSandbox.py, we get this error:

The PythonSandbox.py __find_counters method is expecting 3 values, but it’s only receiving 2, but as far as we can tell, the method is passing 3 values. The tutorial does not go in dept on this, as this issue is unexpected.

If anyone has any experience with OpenCV and Python, our programmers are stuck.

Here is our PythonSandbox.py file:

Thanks for any assistance you can provide!


#2

This is likely caused by a difference in the version of OpenCV used in GRIP and the JeVois.

JeVois is currently on OpenCV 4.0.0.

If you look at line 378, it is part of a set of lines that include

im2, contours, hierarchy = cv2.findContours(input, mode=mode, method=method)

I had the same error when I tried running our code from previous years on the new JeVois image.
I fixed it by simply dropping the “im2”.
So, try this:

contours, hierarchy = cv2.findContours(input, mode=mode, method=method)


#3

OP here,
Late follow up, but thank you that solved our issue!