Caprica Software

Picam 2.x Tutorial

Configuration

Before taking pictures, you must create a configuration for the camera.


Configuration API

The camera configuration is created using a fluent builder API.

The code below shows an example configuration with somewhat minimal options specified (more configuration options are available):

MyCameraApplication.java
import uk.co.caprica.picam.CameraConfiguration;
import uk.co.caprica.picam.NativeLibraryException;
import uk.co.caprica.picam.enums.AutomaticWhiteBalanceMode;
import uk.co.caprica.picam.enums.Encoding;

import static uk.co.caprica.picam.CameraConfiguration.cameraConfiguration;
import static uk.co.caprica.picam.PicamNativeLibrary.installTempLibrary;

public class MyCameraApplication {

public static void main(String[] args) throws NativeLibraryException {
installTempLibrary();
CameraConfiguration config = cameraConfiguration()
.width(1920)
.height(1080)
.automaticWhiteBalance(AutomaticWhiteBalanceMode.AUTO)
.encoding(Encoding.JPEG)
.quality(85);
}
}

You can specify as much, or as little, configuration as you like. Sensible default values will be used where needed for any required configuration values that have not been explicitly specified.

If you're using an Integrated Development Environment or a modern text editor with Java support you should get some helpful code-completion prompts when building a configuration object like this.