JavaCPP Presets for libdc1394 - Java bindings for controlling IEEE 1394 (FireWire) digital cameras following IIDC/DCAM specifications
—
Comprehensive camera feature control including exposure, gain, white balance, focus, and advanced parameters for libdc1394.
Retrieves information about available camera features and their capabilities.
/**
* Gets information about all camera features
* @param camera Camera instance
* @param features Output feature set structure
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_get_all(dc1394camera_t camera, dc1394featureset_t features);
/**
* Gets information about a specific feature
* @param camera Camera instance
* @param feature Feature identifier (DC1394_FEATURE_*)
* @param feature_info Output feature information structure
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_get(dc1394camera_t camera, int feature, dc1394feature_info_t feature_info);
/**
* Prints all feature information to stdout
* @param camera Camera instance
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_print_all(dc1394camera_t camera);
/**
* Prints specific feature information to stdout
* @param feature_info Feature information structure
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_print(dc1394feature_info_t feature_info);Usage Example:
import org.bytedeco.libdc1394.*;
import static org.bytedeco.libdc1394.global.dc1394.*;
// Get all feature information
dc1394featureset_t features = new dc1394featureset_t();
int err = dc1394_feature_get_all(camera, features);
if (err != DC1394_SUCCESS) {
dc1394_log_error("Failed to get features: " + err);
return;
}
// Check specific feature availability
dc1394feature_info_t exposureFeature = features.feature(DC1394_FEATURE_EXPOSURE - DC1394_FEATURE_MIN);
if (exposureFeature.available()) {
System.out.println("Exposure control available");
System.out.println("Range: " + exposureFeature.min() + " - " + exposureFeature.max());
System.out.println("Current value: " + exposureFeature.value());
System.out.println("Auto capable: " + exposureFeature.auto_capable());
}
// Print all features
dc1394_feature_print_all(camera);Controls feature values using integer or absolute (floating-point) values.
/**
* Gets the current value of a feature
* @param camera Camera instance
* @param feature Feature identifier
* @param value Output parameter for current value
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_get_value(dc1394camera_t camera, int feature, IntPointer value);
/**
* Sets the value of a feature
* @param camera Camera instance
* @param feature Feature identifier
* @param value New value to set
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_set_value(dc1394camera_t camera, int feature, int value);
/**
* Gets the absolute (floating-point) value of a feature
* @param camera Camera instance
* @param feature Feature identifier
* @param value Output parameter for absolute value
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_get_absolute_value(dc1394camera_t camera, int feature, FloatPointer value);
/**
* Sets the absolute (floating-point) value of a feature
* @param camera Camera instance
* @param feature Feature identifier
* @param value New absolute value to set
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_set_absolute_value(dc1394camera_t camera, int feature, float value);Usage Example:
import org.bytedeco.javacpp.*;
import static org.bytedeco.libdc1394.global.dc1394.*;
// Set exposure using integer value
int err = dc1394_feature_set_value(camera, DC1394_FEATURE_EXPOSURE, 500);
if (err != DC1394_SUCCESS) {
dc1394_log_error("Failed to set exposure: " + err);
}
// Get current exposure value
IntPointer exposureValue = new IntPointer(1);
dc1394_feature_get_value(camera, DC1394_FEATURE_EXPOSURE, exposureValue);
System.out.println("Current exposure: " + exposureValue.get());
// Use absolute values for more precise control
FloatPointer shutterTime = new FloatPointer(1);
dc1394_feature_get_absolute_value(camera, DC1394_FEATURE_SHUTTER, shutterTime);
System.out.println("Current shutter time: " + shutterTime.get() + " seconds");
// Set shutter time to 1/60 second
dc1394_feature_set_absolute_value(camera, DC1394_FEATURE_SHUTTER, 1.0f/60.0f);Controls automatic vs manual modes for camera features.
/**
* Gets the current mode of a feature
* @param camera Camera instance
* @param feature Feature identifier
* @param mode Output parameter for current mode
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_get_mode(dc1394camera_t camera, int feature, IntPointer mode);
/**
* Sets the mode of a feature
* @param camera Camera instance
* @param feature Feature identifier
* @param mode New mode (DC1394_FEATURE_MODE_*)
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_set_mode(dc1394camera_t camera, int feature, int mode);
/**
* Enables or disables absolute value control for a feature
* @param camera Camera instance
* @param feature Feature identifier
* @param pwr Enable/disable state (DC1394_ON or DC1394_OFF)
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_set_absolute_control(dc1394camera_t camera, int feature, int pwr);
/**
* Gets the absolute control state for a feature
* @param camera Camera instance
* @param feature Feature identifier
* @param pwr Output parameter for absolute control state
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_get_absolute_control(dc1394camera_t camera, int feature, IntPointer pwr);Usage Example:
// Set exposure to manual mode
int err = dc1394_feature_set_mode(camera, DC1394_FEATURE_EXPOSURE, DC1394_FEATURE_MODE_MANUAL);
if (err == DC1394_SUCCESS) {
System.out.println("Exposure set to manual mode");
// Now set specific exposure value
dc1394_feature_set_value(camera, DC1394_FEATURE_EXPOSURE, 300);
}
// Enable auto gain
dc1394_feature_set_mode(camera, DC1394_FEATURE_GAIN, DC1394_FEATURE_MODE_AUTO);
// Use one-push auto white balance
dc1394_feature_set_mode(camera, DC1394_FEATURE_WHITE_BALANCE, DC1394_FEATURE_MODE_ONE_PUSH_AUTO);
// Enable absolute control for shutter
dc1394_feature_set_absolute_control(camera, DC1394_FEATURE_SHUTTER, DC1394_ON);
dc1394_feature_set_absolute_value(camera, DC1394_FEATURE_SHUTTER, 0.01f); // 10msRetrieves minimum and maximum values for features.
/**
* Gets the minimum and maximum values for a feature
* @param camera Camera instance
* @param feature Feature identifier
* @param min Output parameter for minimum value
* @param max Output parameter for maximum value
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_get_boundaries(dc1394camera_t camera, int feature,
IntPointer min, IntPointer max);
/**
* Gets the absolute minimum and maximum values for a feature
* @param camera Camera instance
* @param feature Feature identifier
* @param min Output parameter for absolute minimum value
* @param max Output parameter for absolute maximum value
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_get_absolute_boundaries(dc1394camera_t camera, int feature,
FloatPointer min, FloatPointer max);Special controls for two-component white balance feature.
/**
* Gets white balance BU (Blue/U) and RV (Red/V) values
* @param camera Camera instance
* @param u_b_value Output parameter for U/B component
* @param v_r_value Output parameter for V/R component
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_whitebalance_get_value(dc1394camera_t camera,
IntPointer u_b_value, IntPointer v_r_value);
/**
* Sets white balance BU (Blue/U) and RV (Red/V) values
* @param camera Camera instance
* @param u_b_value U/B component value
* @param v_r_value V/R component value
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_whitebalance_set_value(dc1394camera_t camera,
int u_b_value, int v_r_value);Usage Example:
// Get current white balance values
IntPointer uValue = new IntPointer(1);
IntPointer vValue = new IntPointer(1);
dc1394_feature_whitebalance_get_value(camera, uValue, vValue);
System.out.println("White balance - U/B: " + uValue.get() + ", V/R: " + vValue.get());
// Set white balance for tungsten lighting
dc1394_feature_whitebalance_set_value(camera, 95, 150);Special controls for camera temperature feature.
/**
* Gets camera temperature in Kelvin
* @param camera Camera instance
* @param target_temperature Output parameter for target temperature
* @param current_temperature Output parameter for current temperature
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_temperature_get_value(dc1394camera_t camera,
IntPointer target_temperature,
IntPointer current_temperature);
/**
* Sets target camera temperature in Kelvin
* @param camera Camera instance
* @param target_temperature Target temperature in Kelvin
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_temperature_set_value(dc1394camera_t camera, int target_temperature);Enables or disables individual features.
/**
* Turns a feature on or off
* @param camera Camera instance
* @param feature Feature identifier
* @param pwr Power state (DC1394_ON or DC1394_OFF)
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_set_power(dc1394camera_t camera, int feature, int pwr);
/**
* Gets the power state of a feature
* @param camera Camera instance
* @param feature Feature identifier
* @param pwr Output parameter for power state
* @return DC1394_SUCCESS on success, error code on failure
*/
int dc1394_feature_get_power(dc1394camera_t camera, int feature, IntPointer pwr);/**
* Comprehensive feature information structure with complete field set
*/
class dc1394feature_info_t extends Pointer {
/**
* Feature identifier (DC1394_FEATURE_*)
* @return Feature ID constant
*/
int id();
/**
* Feature availability on this camera
* @return true if feature is available, false otherwise
*/
boolean available();
/**
* Absolute value control capability
* @return true if absolute values supported, false otherwise
*/
boolean absolute_capable();
/**
* Readout capability
* @return true if feature can be read, false otherwise
*/
boolean readout_capable();
/**
* On/off control capability
* @return true if feature can be turned on/off, false otherwise
*/
boolean on_off_capable();
/**
* Polarity control capability
* @return true if polarity can be controlled, false otherwise
*/
boolean polarity_capable();
/**
* Current on/off state
* @return Current switch state
*/
int is_on();
/**
* Current control mode
* @return Mode constant (DC1394_FEATURE_MODE_*)
*/
int current_mode();
/**
* Available modes for this feature
* @return Structure containing supported modes
*/
dc1394feature_modes_t modes();
/**
* Available trigger modes (for trigger feature)
* @return Structure containing supported trigger modes
*/
dc1394trigger_modes_t trigger_modes();
/**
* Current trigger mode (for trigger feature)
* @return Trigger mode constant
*/
int trigger_mode();
/**
* Current trigger polarity (for trigger feature)
* @return Trigger polarity constant
*/
int trigger_polarity();
/**
* Available trigger sources (for trigger feature)
* @return Structure containing supported trigger sources
*/
dc1394trigger_sources_t trigger_sources();
/**
* Current trigger source (for trigger feature)
* @return Trigger source constant
*/
int trigger_source();
/**
* Minimum feature value
* @return Minimum integer value
*/
int min();
/**
* Maximum feature value
* @return Maximum integer value
*/
int max();
/**
* Current feature value
* @return Current integer value
*/
int value();
/**
* Blue/U component value for white balance
* @return BU component value
*/
int BU_value();
/**
* Red/V component value for white balance
* @return RV component value
*/
int RV_value();
/**
* Blue component value for white balance
* @return B component value
*/
int B_value();
/**
* Red component value for white balance
* @return R component value
*/
int R_value();
/**
* Green component value for white balance
* @return G component value
*/
int G_value();
/**
* Target value for auto mode
* @return Target value
*/
int target_value();
/**
* Absolute control state
* @return Current absolute control switch state
*/
int abs_control();
/**
* Current absolute value
* @return Current floating-point value
*/
float abs_value();
/**
* Maximum absolute value
* @return Maximum floating-point value
*/
float abs_max();
/**
* Minimum absolute value
* @return Minimum floating-point value
*/
float abs_min();
}/**
* Container for all camera features
*/
class dc1394featureset_t extends Pointer {
/**
* Access individual feature by index
* @param i Feature index (feature_id - DC1394_FEATURE_MIN)
* @return Feature information structure
*/
dc1394feature_info_t feature(int i);
}/**
* Available modes for a specific feature
*/
class dc1394feature_modes_t extends Pointer {
/**
* Number of available modes
* @return Mode count
*/
int num();
/**
* Array of available mode constants
* @param i Mode index
* @return Mode constant
*/
int modes(int i);
}// Basic image quality features
static final int DC1394_FEATURE_BRIGHTNESS = 416;
static final int DC1394_FEATURE_EXPOSURE = 417;
static final int DC1394_FEATURE_SHARPNESS = 418;
static final int DC1394_FEATURE_WHITE_BALANCE = 419;
static final int DC1394_FEATURE_HUE = 420;
static final int DC1394_FEATURE_SATURATION = 421;
static final int DC1394_FEATURE_GAMMA = 422;
// Camera control features
static final int DC1394_FEATURE_SHUTTER = 423;
static final int DC1394_FEATURE_GAIN = 424;
static final int DC1394_FEATURE_IRIS = 425;
static final int DC1394_FEATURE_FOCUS = 426;
// Advanced features
static final int DC1394_FEATURE_TEMPERATURE = 427;
static final int DC1394_FEATURE_TRIGGER = 428;
static final int DC1394_FEATURE_TRIGGER_DELAY = 429;
static final int DC1394_FEATURE_WHITE_SHADING = 430;
static final int DC1394_FEATURE_FRAME_RATE = 431;
// Mechanical control features
static final int DC1394_FEATURE_ZOOM = 432;
static final int DC1394_FEATURE_PAN = 433;
static final int DC1394_FEATURE_TILT = 434;
static final int DC1394_FEATURE_OPTICAL_FILTER = 435;
// Additional features
static final int DC1394_FEATURE_CAPTURE_SIZE = 436;
static final int DC1394_FEATURE_CAPTURE_QUALITY = 437;
// Feature range constants
static final int DC1394_FEATURE_MIN = DC1394_FEATURE_BRIGHTNESS;
static final int DC1394_FEATURE_MAX = DC1394_FEATURE_CAPTURE_QUALITY;
static final int DC1394_FEATURE_NUM = (DC1394_FEATURE_MAX - DC1394_FEATURE_MIN + 1);// Control modes
static final int DC1394_FEATURE_MODE_MANUAL = 736; // Manual control
static final int DC1394_FEATURE_MODE_AUTO = 737; // Automatic control
static final int DC1394_FEATURE_MODE_ONE_PUSH_AUTO = 738; // One-time auto adjustment// Feature power control
static final int DC1394_ON = 1; // Feature enabled
static final int DC1394_OFF = 0; // Feature disabled/**
* Gets human-readable string for feature identifier
* @param feature Feature identifier
* @return Feature name string
*/
String dc1394_feature_get_string(int feature);Usage Example:
for (int feature = DC1394_FEATURE_MIN; feature <= DC1394_FEATURE_MAX; feature++) {
dc1394feature_info_t info = features.feature(feature - DC1394_FEATURE_MIN);
if (info.available()) {
String featureName = dc1394_feature_get_string(feature);
System.out.println(featureName + ": " + info.min() + "-" + info.max());
}
}// Enable auto exposure with specific target value
dc1394_feature_set_mode(camera, DC1394_FEATURE_EXPOSURE, DC1394_FEATURE_MODE_AUTO);
// Set brightness target for auto exposure (if supported)
dc1394feature_info_t brightnessInfo = features.feature(DC1394_FEATURE_BRIGHTNESS - DC1394_FEATURE_MIN);
if (brightnessInfo.available()) {
int targetBrightness = (brightnessInfo.min() + brightnessInfo.max()) / 2;
dc1394_feature_set_value(camera, DC1394_FEATURE_BRIGHTNESS, targetBrightness);
}// Set all features to manual for consistent capture
dc1394_feature_set_mode(camera, DC1394_FEATURE_EXPOSURE, DC1394_FEATURE_MODE_MANUAL);
dc1394_feature_set_value(camera, DC1394_FEATURE_EXPOSURE, 400);
dc1394_feature_set_mode(camera, DC1394_FEATURE_GAIN, DC1394_FEATURE_MODE_MANUAL);
dc1394_feature_set_value(camera, DC1394_FEATURE_GAIN, 100);
dc1394_feature_set_mode(camera, DC1394_FEATURE_WHITE_BALANCE, DC1394_FEATURE_MODE_MANUAL);
dc1394_feature_whitebalance_set_value(camera, 95, 150);// Always check feature availability before use
dc1394feature_info_t shutterInfo = features.feature(DC1394_FEATURE_SHUTTER - DC1394_FEATURE_MIN);
if (shutterInfo.available() && shutterInfo.manual_capable()) {
dc1394_feature_set_mode(camera, DC1394_FEATURE_SHUTTER, DC1394_FEATURE_MODE_MANUAL);
// Set to middle of range
int midValue = (shutterInfo.min() + shutterInfo.max()) / 2;
dc1394_feature_set_value(camera, DC1394_FEATURE_SHUTTER, midValue);
} else {
System.out.println("Manual shutter control not available");
}Install with Tessl CLI
npx tessl i tessl/maven-org-bytedeco--libdc1394