Hello,
Currently, our team is trying to use an orangepi5 to run custom vision code. We have an Ubuntu Jammy Server installed on it with cscore, ntcore, openCV headless, and a bunch of other libraries installed on it.
We followed this example (robotpy-cscore/examples/intermediate_cameraserver.py at main · robotpy/robotpy-cscore · GitHub), but we’re getting Segmentation Faults. We got rid of all of the rectangle stuff and confirmed that we’re getting a proper connection to Camera Server because we can see stuff from Shuffleboard, but when we add “time, sink = cvSink.getFrame(img)” into our code, it gives us the Segmentation Fault.
Here is the output and the code we used (I don’t know how to copy things from terminal):
Thanks, that’s helpful. It looks like there’s a bug in the robotpy cscore bindings, I was able to reproduce the issue locally. I’ll take a look tonight.
This is going to be challenging to solve, so I’ll have to look at it later.
The core problem is that the original numpy array is being destroyed, and the new numpy array is referring to the old data. To prevent the crash from happening, you just need to keep a reference to the original data:
img = np.zeros(shape=(480, 640, 3), dtype=np.uint8)
# this keeps the original image data around
imgref = img
while True:
time, img = cvSink.grabFrame(img)