For code samples of LUT-based image manipulation, please check out our lut-examples repository.
Lookup Table
Usage
metrical shape lut [OPTIONS] --camera <CAMERA> <INPUT_PLEX> <ARTIFACT>
command = "shape-lut"
input-plex = "{{calibrate-stage.results}}"
format = "json|msgpack"
camera = "camera_to_generate_lut_for"
artifact = "{{auto}}"
Purpose
It's not always easy to adopt a new camera model. Sometimes, you just want to apply a correction and not have to worry about getting all of the math right. The LUT subcommand gives you a shortcut: it describes the locations of the mapped pixel values required to apply a calibration to an entire image.
Note that a lookup table only describes the correction for an image of the same dimensions as the calibrated image. If you're trying to downsample or upsample an image, you'll need to derive a new lookup table for that image dimension.
These lookup tables can be used as-is using OpenCV's lookup table routines; see this open-source repo on applying lookup tables in OpenCV for an example.
Examples
Create a correction lookup table for camera ir_one
metrical shape lut --camera ir_one <INPUT_PLEX> <ARTIFACT>
Arguments
[INPUT_PLEX]
The path to the input plex. This can be a MetriCal Results MCAP or a plex JSON.
[ARTIFACT]
The artifacts output location.
Options
Global Arguments
As with every command, all global arguments are supported (though not all may be used).
-a, --camera [CAMERA]
The camera to generate a LUT for. Must be a camera component reference such as a UUID or component name.
-f, --format [FORMAT]
Default:
jsonWhat serializer to use to format the output. Possible values:
- json: Output the shape data as JSON
- msgpack: Output the shape data as MsgPack