|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
LifeCam USBCamera changing settings from Java
We are trying to use the LifeCam and the USBCamera class for our vision processing. One thing we need is the ability to control exposure and brightness so we get a good image going into our image processing pipeline.
So far I have been able to get an image on the SmartDashboard, provide a way to enter Exposure and Brightness values on the SmartDashboard and send them to the USBCamera class. The problem is, when I change the values, the image doesn't change brightness or exposure. I know the image is updating because I see the motion in new frames. Here is what we're currently doing: Startup: Code:
USBCamera targetCam = new USBCamera("cam0"); // create connection to camera
NIVision.Image frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB,0); // create frame buffer
targetCam.openCamera(); // open the camera connection
targetCam.startCapture(); // start the frame capturing process (internal to USBCamera)
Code:
targetCam.getImage(frame); // retrieve a frame from the USBCamera class CameraServer.getInstance().setImage(frame); // push that frame to the SmartDashboard using the CamServer class Now adding the brightness/exposure control to the loop Loop: Code:
int exposure = Preferences.getInstance.getInt("camExposure", 50);
int brightness = Preferences.getInstance.getInt("camBrightness", 50);
if (brightness <= 100 && brightness >=0)
targetCam.setBrightness(brightness);
if (exposure <=100 && exposure >= 0)
targetCam.setExposureManual(exposure);
targetCam.UpdateSettings();
updatedBrightness = targetCam.getBrightness();
SmartDashboard.putNumber("Current Brightness", updatedBrightness);
targetCam.getImage(frame); // retrieve a frame from the USBCamera class
CameraServer.getInstance().setImage(frame); // push that frame to the SmartDashboard using the CamServer class
Does anyone have any experience on getting this to work? Any hints, tips or suggestions? We may have to punt with the USBCam and switch to the Axis Cam, which would be a shame since the LifeCam is so compact and "simple" |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|