Launch Python OpenCV code from Java Robot Program

Many people find that OpenCV and numpy are a lot easier to use from Python than from Java, so you may find yourself in the situation where you’d really like to do that and run the code on your RoboRIO, but you still want to write your robot code using Java.

Well, I’ve added an example to the robotpy-cscore repository that will allow you to do this – “just” add the CameraServer.java file to your robot project, modify build.xml to include your vision.py file, install robotpy-cscore on your robot and you’re good to go! The module would be launched using robotpy’s camera server, which is compatible with the various dashboards out there.

I’ve tried this on a roborio, and it seems to work. Haven’t done much beyond that though. Let me know if you find this useful!