spymicmac.asp#
spymicmac.asp is a collection of tools for interfacing with Ames Stereo Pipeline
initializing camera files#
- spymicmac.asp.cam_from_footprint(fn_img, flavor, scan_res, fn_dem, north_up=True, footprints=None, datum=None, mean_el=1000, use_3d_vel=True)[source]#
Generate a camera (.tsai) file from an image footprint.
- Parameters:
fn_img (str) – the filename of the image to generate a camera for.
flavor (str) – what type of camera the image came from - currently either KH4 or KH9
scan_res (float) – the scanning resolution of the image
fn_dem (str | Path) – the filename of the reference DEM
north_up (bool) – whether the top of the image corresponds to North or not
footprints (GeoDataFrame) – a GeoDataFrame containing image footprints and an ID field with image names. If not provided, will attempt to download from USGS.
datum (str | None) – the geodetic datum to use. If not set, will try to guess from the DEM (or default to WGS84). See ASP docs for list of options.
mean_el (float | int | None) – the mean surface elevation covered by the image. If None, uses DEM and footprint to calculate the value.
use_3d_vel (bool) – use a 3D velocity vector, rather than a 1D speed. Requires ASP 3.6.0 or greater.
- Returns:
- spymicmac.asp.optical_bar_cam(fn_img, flavor, out_name, fprint=None, scan_res=7e-06, mean_el=1000, use_3d_vel=True)[source]#
Generate a sample ASP camera file for a KH-4 Optical Bar camera.
- Parameters:
fn_img (str) – the filename of the image. Used to read the image size, and determine whether the image is from the aft or forward camera.
flavor (str) – what type of camera the image came from - currently either KH4 or KH9
out_name (str) – the filename to write the camera file to.
fprint (Polygon | None) – an optional image, footprint used to estimate the initial camera position
scan_res (float) – the image scanning resolution, in m per pixel (e.g., 7 microns -> 7.0e-6)
mean_el (float | int) – the mean elevation covered by the image
use_3d_vel (bool) – use a 3D velocity vector, rather than a 1D speed. Requires ASP 3.6.0 or greater.
- Return type:
None
bundle adjustment#
miscellaneous#
- spymicmac.asp.meas_to_asp_gcp(fn_gcp, fn_meas, imlist, outname=None, scale=1, singles=False)[source]#
Convert image measures stored in a micmac xml file to an ASP .gcp file format.
- Parameters:
fn_gcp (str) – the filename of the shapefile with the GCP coordinates
fn_meas (str) – the filename of the xml file with the image measures
imlist (list) – the image(s) to write point locations for
outname (str) – the name of the output filename to create (default: {fn_meas}.gcp)
scale (int) – the factor by which to scale the image point locations (default: 1)
singles (bool) – write gcps present in only a single image (default: False)
- Return type:
None