capture
capture
#
Procedures that capture data from device hardware.
Procedures that interact with device hardware to capture data from cameras, sensors, and other device capabilities. All capture procedures require user interaction and pause workflow execution until the user completes the action.
Example
import capturegraph as cg
class Session(cg.Struct):
photo: cg.Image
location: cg.Location
class FieldData(cg.Struct):
sessions: cg.Map[cg.Date, Session]
@cg.procedure(FieldData)
def field_capture(root: cg.Procedure[cg.Path[FieldData]]):
session = root.sessions[cg.CaptureTime()]
session.photo &= cg.CaptureImage(label="Site Photo")
session.location &= cg.CaptureLocation()
CaptureAlignedImage
#
Capture an image aligned to a reference image for consistent positioning.
Used for timelapse photography or when you need multiple images taken from the same perspective. The app guides the user to align their camera with the reference image before allowing capture.
Attributes:
| Name | Type | Description |
|---|---|---|
reference_image |
Input[Image]
|
The image to align against. |
encoding |
Input[ImageEncoding]
|
How the photo is stored (default: |
alignment |
Input[ReferenceAlignment]
|
Whether alignment to the reference is mandatory
(default: |
exposure_matching |
Input[ExposureMatching]
|
Whether the reference image's exposure (shutter +
ISO, from its EXIF) is applied to the aligned shot so brightness
matches (default: |
Example
Source code in capturegraph-lib/capturegraph/procedures/nodes/collection/capture.py
CaptureConstantColorImage
#
Capture an image using Apple's iOS 18 Constant Color API.
Uses flash with constant color correction to capture an image with consistent color temperature, removing the influence of ambient lighting. Useful for material scanning, product photography, and situations requiring accurate color. Requires iOS 18+ and a device with flash support.
Attributes:
| Name | Type | Description |
|---|---|---|
encoding |
Input[ImageEncoding]
|
How the photo is stored (default: |
Source code in capturegraph-lib/capturegraph/procedures/nodes/collection/capture.py
CaptureFlashNoFlash
#
Capture a pair of images: one with flash and one without.
This capture mode is useful for computational photography applications that need to separate flash illumination from ambient lighting. The result is a bundle containing two named images: 'flash' and 'no_flash'.
Attributes:
| Name | Type | Description |
|---|---|---|
encoding |
Input[ImageEncoding]
|
How the photos are stored (default: |
Example
Source code in capturegraph-lib/capturegraph/procedures/nodes/collection/capture.py
CaptureImage
#
Capture a single image using the device camera.
The most basic image capture procedure that prompts the user to take a photo. The captured image can then be saved, processed, or used as input to other procedures.
Attributes:
| Name | Type | Description |
|---|---|---|
encoding |
Input[ImageEncoding]
|
How the photo is stored (default: |
Example
Source code in capturegraph-lib/capturegraph/procedures/nodes/collection/capture.py
CaptureImageSequence
#
Bases: Procedure[Array[Image]]
Capture multiple images in sequence as a bundle.
Prompts the user to capture several related images that will be grouped together. Useful for creating image series, documenting multiple angles, or collecting related visual data.
Attributes:
| Name | Type | Description |
|---|---|---|
encoding |
Input[ImageEncoding]
|
How the photos are stored (default: |
Example
Source code in capturegraph-lib/capturegraph/procedures/nodes/collection/capture.py
CaptureImagesByLabel
#
Bases: Procedure[Map[String, Array[Image]]]
Capture one image sequence per label, returning a map from label to sequence.
Each label becomes its own capture button; the user collects any number of
images under each. The result is a Map[String, Array[Image]] keyed by the
labels — index it to use one label's sequence (photos["Front"], a
MapKey), or cache the whole map into a Map[String, …] slot. A key that
is not one of the labels produces no value, so its cache stores nothing.
Attributes:
| Name | Type | Description |
|---|---|---|
labels |
Setting[list[str]]
|
The capture buttons, one per string (order preserved). The keys of the returned map. |
encoding |
Input[ImageEncoding]
|
How the photos are stored (default: |
Example
Source code in capturegraph-lib/capturegraph/procedures/nodes/collection/capture.py
static_map_keys()
#
The labels, known at authoring time since they are a fixed setting.
CaptureLocation
#
Capture the current GPS location of the device.
Records the device's current latitude, longitude, altitude, and other location metadata. Useful for geotagging data collection or tracking where measurements were taken.
Source code in capturegraph-lib/capturegraph/procedures/nodes/collection/capture.py
CapturePanorama
#
Bases: Procedure[ImagePanorama]
Capture a panorama as a sequence of oriented photos.
Photosynth-style capture: the user rotates the device about the camera's optical center while photos are placed on a sphere using the gyroscope. Photos fire automatically when the viewfinder reaches uncovered area (with a manual mode available). The result bundles each image with the device orientation at capture, plus an equirectangular preview composite.
Attributes:
| Name | Type | Description |
|---|---|---|
encoding |
Input[ImageEncoding]
|
How the photos are stored (default: |
overlap_ratio |
Input[Number]
|
Fraction of the field of view shared between adjacent frames; higher values fire more, closer photos (default: 0.6). |
Example
Source code in capturegraph-lib/capturegraph/procedures/nodes/collection/capture.py
CaptureTime
#
Capture the current timestamp when the procedure executes.
Records the exact date and time when this procedure is executed, which can be useful for timestamping data collection or measuring time intervals between procedures.
Source code in capturegraph-lib/capturegraph/procedures/nodes/collection/capture.py
CaptureVideo
#
Capture a video using the device camera.
Prompts the user to record a video. The recorded video can then be saved or used as input to other procedures.
Attributes:
| Name | Type | Description |
|---|---|---|
dynamic_range |
Input[DynamicRange]
|
Whether the clip records SDR or 10-bit HDR
(default: |
format |
Input[VideoFormat]
|
The frame-rate floor / resolution priority (default:
|
exposure_lock |
Input[ExposureLock]
|
Whether exposure and white balance freeze for the
whole clip (default: |
Note
The default dynamic_range is a single Constant node created at
class definition — every instance that omits the field shares that one
node (one UUID) in the serialized graph.
Example
# Simple video capture
session.video &= cg.CaptureVideo(label="Record Video")
# HDR video capture
session.video &= cg.CaptureVideo(label="HDR Video", dynamic_range=cg.DynamicRange.HDR)
# Slow-motion capture
session.video &= cg.CaptureVideo(label="Slow-Mo", format=cg.VideoFormat.SLOW_MOTION)
# Lock exposure and white balance for a photometrically stable clip
session.video &= cg.CaptureVideo(label="Locked Video", exposure_lock=cg.ExposureLock.LOCKED)
Source code in capturegraph-lib/capturegraph/procedures/nodes/collection/capture.py
CaptureWeather
#
Capture current weather conditions at a location.
Retrieves weather information such as temperature, humidity, atmospheric pressure, and conditions. Useful for environmental data collection and context.
Attributes:
| Name | Type | Description |
|---|---|---|
location |
Input[Location]
|
Location to fetch weather for. Defaults to a |