spymicmac.register#
spymicmac.register is a collection of tools for registering images and finding GCPs.
- spymicmac.register.register_relative(dirmec, fn_dem, fn_ref=None, fn_ortho=None, glacmask=None, landmask=None, footprints=None, globstr='OIS*.tif', im_subset=None, block_num=None, subscript=None, ori='Relative', ortho_res=8.0, imgsource='DECLASSII', strategy='grid', density=200, out_dir=None, allfree=True, dir_homol='Homol', useortho=False, max_iter=5, use_cps=False, cp_frac=0.2, use_orb=False, fn_gcps=None, use_blur=False, use_highpass=True, use_hillshade=False, hillshade_kwargs={}, rap_txt=None)[source]#
Register a relative DEM or orthoimage to a reference DEM and/or orthorectified image.
- Parameters:
dirmec (str) – the name of the MEC directory to read the relative DEM from (e.g., MEC-Relative)
fn_dem (str | Path) – path to reference DEM
fn_ref (str | Path | None) – path to reference orthorectified image (optional)
fn_ortho (str | Path | None) – path to relative orthoimage (optional)
glacmask (str | Path | None) – path to file of glacier outlines (i.e., an exclusion mask)
landmask (str | Path | None) – path to file of land outlines (i.e., an inclusion mask)
footprints (str | Path | None) – path to shapefile of image outlines. If not set, will look for Footprints.gpkg in the current directory. If this file does not exist, will attempt to download from USGS using imgsource.
globstr (str) – the search string to use to find images in the current directory
im_subset (str | None) – subset of raw images to work with
block_num (str | None) – block number to use if processing multiple image blocks
subscript (str | None) – optional subscript to use for output filenames
ori (str) – name of orientation directory (after Ori-)
imgsource (str) – USGS dataset name for images
strategy (str) – strategy for generating GCPs. Must be one of ‘grid’, ‘random’, ‘chebyshev’, or ‘peaks’. Note that if ‘random’ is used, density is the approximate number of points, rather than the distance between grid points. If ‘peaks’ is used, peaks will be spaced by at least (density/2) pixels.
density (int) – pixel spacing to look for GCPs
out_dir (str | Path | None) – output directory to save auto GCP files to
allfree (bool) – run Campari setting all parameters free
dir_homol (str) – the name of the Homol directory to use for Campari (default: Homol)
useortho (bool) – use the orthomosaic in Ortho-{dirmec} rather than the DEM. If fn_ortho is set, uses that file instead.
max_iter (int) – the maximum number of Campari iterations to run.
use_cps (bool) – split the GCPs into GCPs and checkpoints (CPs), to quantify the uncertainty of the camera model
cp_frac (float) – the fraction of GCPs to use as CPs when splitting into GCPs and CPs
use_orb (bool) – use skimage.feature.ORB to identify GCP locations in the reference image (default: use regular grid for matching)
fn_gcps (str | Path | None) – (optional) shapefile or CSV of GCP coordinates to use. Column names should be [(name | id), (z | elevation), x, y]. If CSV is used, x,y should have the same CRS as the reference image.
use_blur (bool) – use a gaussian blur on the relative image before matching
use_highpass (bool) – match templates using a highpass filter
use_hillshade (bool) – match templates using DEM hillshade rather than elevation
hillshade_kwargs (dict) – kwargs to pass to xdem.DEM.hillshade()
rap_txt (str | Path | None) – filename for the per-point residual report from Campari, if desired
ortho_res (float | int)
- Return type:
None