Hello. I’m on FRC team 2335 and while we’re hoping to get some vision processing going this year, we’re running into seemingly-inexplicable behavior.
We’re running the python example downloaded through the FRC Console on a Raspberry Pi. It’s a 2 Model B running the provided image. The example as is works fine. Upon further testing, we’ve found that the script works fine up until the
capture = cv2.VideoCapture('/dev/video0') line. We’re trying to get video for separately written image processing code for the reflective tape, but it “freezes” on this step instead and doesn’t execute any code after it.
Instead of returning a VideoCapture object as we would expect from the documentation, the console output appears to indicate it getting stuck in some other thread (or something like that).
Additionally, we tried to grab the frames directly from the camera server using
sink = CameraServer.getInstance().getVideo(camera=cameras) and
sink.grabFrame(sourceFrame, timeout=3) (sourceFrame is a numpy array with the shape [240, 352, 3] for 240p resolution). However, grabFrame() doesn’t seem to actually grab the frame, it times out.
Might any of you had success using a Pi for image processing, or have an idea on why VideoCapture is not behaving as expected? Or any alternative method to capturing the camera image for cv2 processing on the pi? We’d really appreciate it.