Installing latest robotpy cscore / CameraServer on nvidia Jetson

Just wanted to share a success… I was struggling to get the latest robotpy-cscore on my nvidia Jetson. I was previously using the repo from @auscompgeek to install, but it has not been updated in a while. I found this old thread, but it seems to be quite out of date.

I successfully got it installed by setting the include directory and using pip.

export CPPFLAGS=-I/usr/include/opencv4
pip install robotpy-cscore

I hope someone else finds this usefull, or can point out any flaw with this approach.

1 Like

The build should be able to find opencv4 without intervention, as long as you have pkgconfig installed.

I ran it on two Jetson Nanos and neither worked without setting CPPFLAGS.

pkgconfig does seem to find opencv4:

$ pkg-config opencv4 --cflags-only-I
-I/usr/include/opencv4/opencv -I/usr/include/opencv4

Did you install the pkgconfig Python package?

1 Like

No, that’s not in the docs so I didn’t know it was needed.

It’s subtle, but…

If you use OpenCV 4, you must also compile with -DOPENCV_GENERATE_PKGCONFIG=ON and install pkgconfig via pip for robotpy-cscore to find it.

Oh, there it is. That wasn’t clear to me. It’s under the section about compiling OpenCV, which I did not do. OpenCV is preinstalled on the Jetson.

Was I supposed to set DOPENCV_GENERATE_PKGCONFIG=ON when executing pip install robotpy-cscore? I did not and it seems to be working.

Hm? There’s no section about compiling OpenCV in the docs. There is a bullet point about it, but that’s about it. Is that what you’re referring to? Maybe I need to make it clearer those are two entirely separate bullet points.

-DOPENCV_GENERATE_PKGCONFIG=ON is a cmake build option for OpenCV. Your pkg-config call found opencv4, so the OpenCV you have installed would’ve been built with that.