Custom Code for Multi Vision Processing on rPi

How can I process multiple camera’s images via rpi based on the example code given by FIRST? It seems to be supporting one camera at a time only. Or is there anyone knows that where’s the code used by default on rPi which support multi camera streaming?

Are you talking about multi camera processing or multi camera streaming? All example programs provided with the FRCVision image implement multi-camera streaming identical to that provided by the default code. They can either be downloaded directly from the Pi or downloaded from the FRCVision releases page.

For multi-camera processing, there’s variants of CameraServer.getVideo() that take a VideoSource or camera name. It’s basically the same approach as used in the examples from that point on.

Thanks for your quick reply!!

The reason I thought the example code doesn’t support multi camera processing is because that I had only seen it declares one configFile, which is created by default, called “frc.json”.

After reading the code, I suggested that each configFile refers to one specific camera. So doesn’t it mean that I need to declare more than one configFile to have multiple cameras been detected?

The single frc.json file stores the configuration for all the cameras as well as NetworkTables etc. The code has a loop over the cameras list in the frc.json file to create each one. See e.g. https://github.com/wpilibsuite/FRCVision-pi-gen/blob/frcvision/deps/examples/java-multiCameraServer/src/main/java/Main.java#L212-L217

That was fantastic!!!

I really appreciate your selfless help. Without it, I would be stucked for about a month or more as a result of being unable to find any information about the “frc.json” file on the Internet.

Emm…may I ask in which part does the code have a loop over the camera list?

I don’t quite understand about how the code operates.

Lines 212-217 of Main.java read from the JSON file (looping over the JSON array). The readCameraConfig function appends the camera configuration to the cameraConfigs array on line 135. After the configurations have been read into the cameraConfigs array, lines 318-320 loop over that array, starting each camera.

Oh~~I see, there is a “for” loop at line 170 in function “readCameraConfig”. It was a mistake caused by the lack of carefully reading, sorry for wasting your time, and I really appreciate your help.

Last, I’m sorry for replying so late. I was working on another project, so I didn’t have time to work on this.

See you.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.