The "Intermediate Vision" example project contains an example of getting an image from usb camera, modifying it, and then sending it to the dashboard. To have a system where you have multiple cameras and want to choose which img from which camera gets sent to the dashboard you'll need to do several things. The following code examples are in java but it should be similar in c++.
1) You need to create ids for each camera by supplying the camera name, the camera name shows up on the roborio interface ("roborio-TEAM.local/" where TEAM is your team number, "roborio-2853.local/" in your case)
Code:
// Get camera ids by supplying camera name ex 'cam0', found on roborio web interface
camCenter = NIVision.IMAQdxOpenCamera("cam0", NIVision.IMAQdxCameraControlMode.CameraControlModeController);
camRight = NIVision.IMAQdxOpenCamera("cam1", NIVision.IMAQdxCameraControlMode.CameraControlModeController);
2) You need to create an img variable where the img from the camera will be stored to and create a CameraServer that will send it to the dashboard
Code:
// Img that will contain camera img
frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);
// Server that we'll give the img to
server = CameraServer.getInstance();
3) Before getting imgs from a camera and sending it to the CameraServer you need to setup the camera for streaming and close the streaming of the previous camera
Code:
NIVision.IMAQdxStopAcquisition(prevCamId);
NIVision.IMAQdxConfigureGrab(newCamId);
NIVision.IMAQdxStartAcquisition(newCamId);
4) Now for the imgs from the camera to actually show up you need to get imgs from the camera and give them to the CameraServer
Code:
NIVision.IMAQdxGrab(curCamId, frame, 1);
server.setImage(frame);
Link to example java project:
https://github.com/Merfoo/MultiCamera
If you have any questions feel free to ask
