spymicmac.register
spymicmac.register is a collection of tools for registering images and finding GCPs.
- spymicmac.register.nmad(values, nfact=1.4826)[source]
Calculate the normalized median absolute deviation (NMAD) of an array.
- Parameters:
values (array-like) – input data
nfact (float) – normalization factor for the data; default is 1.4826
- Returns nmad:
(normalized) median absolute deviation of data.
- 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', density=200, out_dir=None, allfree=True, useortho=False, max_iter=5)[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 to reference DEM
fn_ref (str) – path to reference orthorectified image (optional)
fn_ortho (str) – path to relative orthoimage (optional)
glacmask (str) – path to file of glacier outlines (i.e., an exclusion mask)
landmask (str) – path to file of land outlines (i.e., an inclusion mask)
footprints (str) – path to shapefile of image outlines. If not set, will download from USGS.
im_subset (str) – subset of raw images to work with
block_num (str) – block number to use if processing multiple image blocks
subscript (str) – optional subscript to use for output filenames (default: None)
ori (str) – name of orientation directory (after Ori-) (default: Relative)
ortho_res (float) – approx. ground sampling distance (pixel resolution) of ortho image (default: 8 m)
imgsource (str) – USGS dataset name for images (default: DECLASSII)
density (int) – pixel spacing to look for GCPs (default: 200)
out_dir (str) – output directory to save auto GCP files to (default: auto_gcps)
allfree (bool) – run Campari setting all parameters free (default: True)
useortho (bool) – use the orthomosaic in Ortho-{dirmec} rather than the DEM (default: False). If fn_ortho is set, uses that file instead.
max_iter (int) – the maximum number of Campari iterations to run. (default: 5)
- spymicmac.register.warp_image(model, ref, img)[source]
Given a transformation model between two coordinate systems, warp an image to a reference image
- Parameters:
model (GeometricTransform) – the transformation model between the coordinate systems
ref (Raster) – the reference Raster
img (Raster) – the Raster to be transformed
- Returns:
tfm_img (np.array) – the input image transformed to the same extent as the reference image
this_model (AffineTransform) – the estimated Affine Transformation between the two images
inliers (array-like) – a list of the inliers returned by skimage.measure.ransac