spymicmac.register

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, 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, useortho=False, max_iter=5, use_cps=False, cp_frac=0.2, use_orb=False, fn_gcps=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.

  • 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-)

  • ortho_res (float | int) – approx. ground sampling distance (pixel resolution) of ortho image

  • imgsource (str) – USGS dataset name for images

  • strategy (str) – strategy for generating GCPs. Must be one of ‘grid’, ‘random’, or ‘chebyshev’. Note that if ‘random’ is used, density is the approximate number of points, rather than the distance between grid points.

  • 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

  • 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) – (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.

Return type:

None