Log in

View Full Version : Camera Calibration in Java Visible in Dashboard View


michael714
08-02-2011, 20:51
Hey Folks,
We are interested in making camera calibration possible via the dashboard. We have some code that allows us to receive values from the Analog Sliders on the dashboard. We then used those values to change "camera" settings. Unfortunately, we see no evidence of the dashboard camera image changing (like when we do a 180 degree rotation or a brightness adjust).

Is it possible to make adjustments via Java to the camera that show up on dashboard? If so, where do we go to learn more? Can we do this without modifying the LabView dashboard?

We've looked through the 2011 WPI Lib Reference doc. We went through the NI Vision Tutorial doc. We've also looked through all the FRC Java docs. Any thoughts would be appeciated.

omalleyj
09-02-2011, 08:10
Have you tried something like this?

import ...AxisCamera;
import ...DriverStation;


public class CameraControl{
AxisCamera ac = AxisCamera.getInstance();
DriverStation ds = DriverStation.getInstance();

public CameraControl(){
updateCameraControl();
}

public void updateCameraControl(){
//convert to 0..100 int
int brightness = (int)(ds.getAnalogIn(1) * 100.0/5.0);
ac.writeBrightness(brightness);
}

}


I am not at our robot and source code right now but I did something similar last year. Call an instance of the above class's update method in a loop and use analog slider 1 to adjust brightness. If that works add some other parameters.

michael714
09-02-2011, 17:37
We did those things, but not using the updateCameraControl method. Instead, we just placed the update code in teleop Periodic and expected the looping to allow the adjustment to take place. We'll give your code a try.
Thanks.

omalleyj
10-02-2011, 09:49
We did those things, but not using the updateCameraControl method. Instead, we just placed the update code in teleop Periodic and expected the looping to allow the adjustment to take place. We'll give your code a try.
Thanks.

It doesn't have to be in a separate class, I just provided it that way so you could keep it separate from your own code more easily. The updateCameraControl was just a way to package it, if you are using the writeBrightness() directly that is fine (or would be if it worked :confused: ).
Can you get the input from AnalogIn directly? You can see the value is actually changing?
Can you set the brightness et al. from the Axis camera app?
Do any of the wpilibj camera functions work for you? I know you tried a 180 and brightness already, any others?