User Tools

Site Tools


script-hdr-ricoh-theta

HDR capturing with Ricoh Theta cameras

This example shows how to capture exposure series (e.g. for HDR) using exposure compensation using Ricoh Theta cameras. The following steps are executed:

  1. Connect the script to a camera.
  2. Set the camera mode to photo.
  3. Enable the “normal” camera mode.
  4. Set the exposure compensation.
  5. Capture image.
// Helper function for capturing an image with a specific exposure
function captureImage(cameraName, exposureCommand) {
    // Set exposure
    var result = sendCustomCameraCommand(cameraName, exposureCommand);
    if (!result.ok) {
        logMessage("Error setting exposure: " + result.message, true);
    }
 
    // Capture photo
    result = startRecording(cameraName);
    if (!result.ok) {
        logMessage("Error capturing photo: " + result.message, true);
    }
}
 
// Use the currently connected camera:
var connectResult = connectToCamera();
if (connectResult.ok) {
    var cameraName = connectResult.message;
 
    // Change the camera mode to 0 (which is photo mode for Theta cameras). The index
    // depends on the camera model.
    var result = changeCameraMode(cameraName, 0);
    if (!result.ok) {
        logMessage("Error changing camera mode to photo: " + result.message, true);
    }
 
    // Give the camera some time for changing the mode
    waitMilliseconds(500);
 
    // Log the current camera mode
    var cameraModeIndex = getCurrentCameraMode(cameraName);
    logMessage("The current camera mode is: " + cameraModeIndex);
 
    // Set manual exposure program
    result = sendCustomCameraCommand(cameraName, "exposureProgram:2");
    if (!result.ok) {
        logMessage("Error enabling program: " + result.message, true);
    }
 
    // Capture three images with different exposures
    captureImage(cameraName, "exposureCompensation:-2"); // 1
    waitMilliseconds(5000); // give the camera some time for capturing. The Theta needs between 5 to 8 seconds!
 
    captureImage(cameraName, "exposureCompensation:0"); // 2
    waitMilliseconds(5000); // give the camera some time for capturing
 
    captureImage(cameraName, "exposureCompensation:2"); // 3
    logMessage("Done");
}
else logMessage("No camera found");
script-hdr-ricoh-theta.txt · Last modified: 2018/03/30 17:07 by teq