Processing

Caution

The panorama image processing requires extra dependencies.

  • opencv-python

Install them manually, or install instrumentman with the ‘panorama’ extra:

python -m pip install instrumentman[panorama]

The processing command can be used to merge individual frames of a panorama capture into a single image, and optionally annotate points on it.

The accuracy of the annotation is usually a few centimeters.

Requirements

  • Image metadata JSON file

  • Images downloaded from the instrument

Examples

Merging images
iman process panorama metadata.json merged_panorama.jpg panorama*.jpg
Merging images and annotating points
iman process panorama --annotate points.csv --fontsize 50 metadata.json merged_panorama.jpg panorama*.jpg
Merging full sphere panorama with downscaling to fit into OpenCV limits
iman process panorama --scale 2000 metadata.json merged_panorama.jpg panorama*.jpg
Example points file for annotations (with the optional label column present)
P0001,1.0,1.0,0.0,BENCHMARK
P0002,1.0,2.0,1.0,BENCHMARK
P0003,1.0,2.0,3.0,TOPO

Usage

iman process panorama

Merge previously captured panorama frames and optionally annotate measured points on the resulting panorama for documentation purposes.

IMPORTANT: This command requires an extra dependency: ‘opencv-python’

The individual images are transformed into an equirectangular projection based on the orientation metadata saved at the time of acquisition. The projected images are then merged into a single panorama image.

On the merged panorama it is possible to annotate measured points given with their 3D coordinates in a CSV file. The file is expected to contain point name, easting, northing and height columns in this order (and optionally a label column as last). The accuracy of the annotation is usually a few centimeters. This is due to errors introduced by the offset and the distortions of the overview camera. The program will try to approximate the offset to improve the accuracy. If the precise offset is known, it can also be provided explicitly.

A limit of OpenCV is, that larger panoramas cannot be processed at full resolution. The maximum size that OpenCV in this configuration can handle is defined by the maximum of a 16-bit signed integer (32767). This means, that at full resolution (2560 x 1920) only 12 images horizontally (for near vertical views not even 1 image), and 17 images vertically can be processed. This can be solved by setting the scale or one of the other sizing options to downscale the processing resolution. (The program automatically downscales to an appropriate size.)

iman process panorama [OPTIONS] METADATA OUTPUT IMAGE...

Options

--shift <shift>

Shift bearing of panorama center to reorient view and potentially remove black gaps (only exact for strip and sphere)

--compensation <compensation>

Basic exposure compensation method

Options:

none | channels | gain

--blending <blending>

Overlap blending method

Options:

none | multiband | feather

--seams <seams>

Method to delineate individual frames at overlaps

Options:

none | voronoi | dynamic-programming

--seam-overlap <seam_overlap>

Pixel dilation of seam masks to provide blending overlap (set to -1 for automatic calculation)

--visualize-stitch

Debug option to show individual frames with random colors

--scale <scale>

Panorama scale in [pixels/rad]

--width <width>

Width of complete sphere panorama in [pixels]

--height <height>

Height of complete sphere panorama in [pixels]

--annotate <annotate>

CSV coordinate list of points to annotate on the images

--skip <skip>

Number of header rows to skip

--delimiter <delimiter>

Column delimiter

--color <color>

Color in RGB8 notation

--font <font>

Font face type

Options:

plain | simplex | duplex | complex

--fontsize <fontsize>

Font size in pixels

--thickness <thickness>

Font line thickness

--marker <marker>

Point marker shape

Options:

cross | x | star | diamond | square | uptriangle | downtriangle

--markersize <markersize>

Point marker size in pixels

--offset <offset>

Point name offset in pixels

--justify <justify>

Point name justification

Options:

tl | tc | tr | ml | mc | mr | bl | bc | br

--label-font <label_font>

Label font face type

Options:

plain | simplex | duplex | complex

--label-fontsize <label_fontsize>

Label font size in pixels

--label_thickness <label_thickness>

Label text line thickness

--label-color <label_color>

Color in RGB8 notation

--label-offset <label_offset>

Label text offset in pixels

--label-justify <label_justify>

Label text justification

Options:

tl | tc | tr | ml | mc | mr | bl | bc | br

Arguments

METADATA

Required argument

Metadata file produced by the measurement program

OUTPUT

Required argument

Output image file path

IMAGE

Required argument(s)

Panorama image part