CLI

A tool for calculating color distances in an

orthomosaic to a reference color based on samples from an annotated image.

usage: CDC [-h] [--output_location OUTPUT_LOCATION] [--save_tiles]
           [--save_ref_pixels] [--save_statistics]
           [--method {mahalanobis,gmm}] [--param PARAM] [--scale SCALE]
           [--gamma_transform GAMMA] [--lambda_transform LAMBDA]
           [--bands_to_use BANDS_TO_USE [BANDS_TO_USE ...]]
           [--alpha_channel ALPHA_CHANNEL]
           [--channel_names_in CHANNEL_NAMES_IN]
           [--channel_names_out CHANNEL_NAMES_OUT]
           [--tile_size TILE_SIZE [TILE_SIZE ...]]
           [--tile_overlap TILE_OVERLAP]
           [--run_specific_tile TILE_ID [TILE_ID ...]]
           [--run_specific_tileset FROM_TILE_ID TO_TILE_ID [FROM_TILE_ID TO_TILE_ID ...]]
           [--max_workers THREADS]
           orthomosaic reference annotated

Input

orthomosaic

Path to the orthomosaic that you want to process.

reference

Path to the reference image.

annotated

Path to the annotated reference image.

Output

--output_location

The location in which to save the tiles and orthomosaic.

Default: output

--save_tiles

If set tiles are saved at output_location/tiles. Useful for debugging or parameter tweaking. Default no tiles are saved.

Default: False

--save_ref_pixels

Save the raw, transformed and selected reference pixels in output_location/pixel_values. Default do not save.

Default: False

--save_statistics

Save statistics of the processed orthomosaic including a histogram of color distances. Files are saved in output_location/statistics. Default do not save.

Default: False

Color Model

--method

Possible choices: mahalanobis, gmm

The method used for calculating distances from the set of annotated pixels. Possible values are ‘mahalanobis’ for using the Mahalanobis distance and ‘gmm’ for using a Gaussian Mixture Model. ‘mahalanobis’ is the default value.

Default: 'mahalanobis'

--param

Numerical parameter for the color model. When using the ‘gmm’ method, this equals the number of components in the Gaussian Mixture Model.

Default: 2

--scale

The calculated distances are multiplied with this factor before the result is saved as an image. Default value is 5.

Default: 5

Transforms

--gamma_transform

Apply a gamma transform with the given gamma to all inputs. Default no transform.

--lambda_transform

Apply a Lambda transform with the given Lambda expression to all inputs. Numpy is available as np. Default no transform.

Image Channels

--bands_to_use

The bands needed to be analyzed, written as a list, 0 indexed. If no value is specified all bands except alpha channel will be analyzed.

--alpha_channel

Alpha channel number 0 indexed. If no value is specified the last channel is assumed to be the alpha channel. If the orthomosaic does not contain an alpha channel use None.

Default: -1

--channel_names_in

Names of the image channels in the input image separated by comma, i.e. (R, G, B, A). Default channels are named c1, c2, …

--channel_names_out

Names of the image channels after the transform separated by comma, i.e. (H, S, V). Default channels are named c1, c2, …

Tiles

--tile_size

The width and height of tiles that are analyzed. If one integer is given tiles are square. Default is (2048, 2048).

Default: [2048]

--tile_overlap

Overlap between tiles as a fraction of tile width and height. E.g. –tile_overlap 0.1 will give a 10% overlap

Default: 0

--run_specific_tile

If set, only run the specific tile numbers. (–run_specific_tile 16 65) will run tile 16 and 65.

--run_specific_tileset

takes two inputs like (–from_specific_tileset 16 65). This will run every tile from 16 to 65.

--max_workers

Maximum number of workers used to process tiles. Default to os.cpu_count() (4).

Default: 4

Program written by SDU UAS Center (hemi@mmmi.sdu.dk) in

2023-2025 as part of the Precisionseedbreeding project supported by GUDP and Frøafgiftsfonden.