The Doctor
06-02-2016, 20:15
I'm trying to get two cameras running on our robot this year. I've started putting some code into our main program [Java]:
globals:
final int numcameras = 2; // we've got this many cameras
int[] cameras;
int curcamera;
NIVision.Image curframe;
CameraServer cserver;
init:
curframe = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_ RGB, 0);
for (int i = 0; i < numcameras; i++) {
cameras[i] = NIVision.IMAQdxOpenCamera("cam" + (i+1), NIVision.IMAQdxCameraControlMode.CameraControlMode Controller);
NIVision.IMAQdxConfigureGrab(cameras[i]);
}
curcamera = 0;
cserver = CameraServer.getInstance();
periodic:
curcamera += 1; curcamera %= numcameras;
NIVision.IMAQdxGrab(cameras[curcamera], curframe, 1);
cserver.setImage(curframe);
...However, this code will rapidly switch between the cameras. What I want to do is write a program to run on the driver station, to "deinterlace" the images, by displaying every other frame in its own spot. I'm quite fluent in Processing (Java with some cool libraries), which would make deinterlacing the images easy if I had the image stream available... My question is: how do I get raw image data from the robot on the driver station? I ideally want a solution that can work through the FMS.
Is there a part of the NIVision library that can receive this stream? Or do I need another Java library? And how is it possible to access the video stream with third-party programs in the DS?
globals:
final int numcameras = 2; // we've got this many cameras
int[] cameras;
int curcamera;
NIVision.Image curframe;
CameraServer cserver;
init:
curframe = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_ RGB, 0);
for (int i = 0; i < numcameras; i++) {
cameras[i] = NIVision.IMAQdxOpenCamera("cam" + (i+1), NIVision.IMAQdxCameraControlMode.CameraControlMode Controller);
NIVision.IMAQdxConfigureGrab(cameras[i]);
}
curcamera = 0;
cserver = CameraServer.getInstance();
periodic:
curcamera += 1; curcamera %= numcameras;
NIVision.IMAQdxGrab(cameras[curcamera], curframe, 1);
cserver.setImage(curframe);
...However, this code will rapidly switch between the cameras. What I want to do is write a program to run on the driver station, to "deinterlace" the images, by displaying every other frame in its own spot. I'm quite fluent in Processing (Java with some cool libraries), which would make deinterlacing the images easy if I had the image stream available... My question is: how do I get raw image data from the robot on the driver station? I ideally want a solution that can work through the FMS.
Is there a part of the NIVision library that can receive this stream? Or do I need another Java library? And how is it possible to access the video stream with third-party programs in the DS?