This resides under ../crs/src/CoastCam on my laptop and under ../src/CoastCam on my Workspaces instance.
Main routines are in two files:
coastcam.py
- Main calibration and rectification routinescoastcam_funcs.py
- Various helper and utility routines
class TargetGrid(target_grid_info,z=0.0)
- Build grid onto which image(s) will be rectifiedclass CameraCalibration(cfg, intrinsics, extrinsics)
- Generate camera calibration object w/ transformation matricesrectify_images(cfg, target_grid, image_files, intrinsic_cal_list, extrinsic_cal_list, fs=None, interp_method = 'rgi')
- Georectify and blend images from multiple cameras
_convert_beta(self)
- Changes world coordinates to local coordinate_systemassembleP(lcp, beta)
- Assembles and returns Projective (P) matrix from LCP and Beta valuesapply_weights_to_pixels(K, W)
- Return pixel intensities (K) weighted by W.local_transform_points( xo, yo, ang, flag, xin, yin)
- Transforms points between local World Coordinates and Geographical (either direction)local_transform_extrinsics(local_xo,local_yo,local_angd,flag,extrinsics_in)
- Tranforms extrinsic vector between Local World Coordinates and Geographicalangle2R(azimuth, tilt, swing)
- Assembles and returns a rotation matrix R from azimuth, tilt, and swing (roll)assemble_image_weights(K)
- Return weight matrix W used for image merging.get_pixels(nx, ny, nc, DU, DV, image, interp_method='rgi')
- Return pixel values for each xyz point from the imagefind_distort_UV(target_grid, calibration)
- get UV for pinhole camera
estimate_sharpness(img)
- Estimate image sharpness and contrastaverage_color(img)
- Calculate the average pixel intensity of an imagedetect_blur_fft(img, size=60, vis=False)
- Use high-frequency content of image fft to determine blur
def json2dict(jsonfile)
- Read a .json file into a dict
dts2unix(date_time_string, timezone='eastern')
- Return the unix epoch time and a datetime object with aware UTC time zoneunix2dts(unixnumber, timezone='eastern')
- Get local time from unix numberfiletime2timestr(filepath, timezone='eastern')
- Return the local time and the Unix Epoch string from an image filename or pathtimestr2filename(date_time_str, camera = 'c1', image_type = 'timex', timezone='eastern')
- Return a filename given a date_time_str and other info
./original_code
- Code from Axiom provided by Brittany Bruder with minimum modifications to run with USACE examples
rectifyer.py
- Axiom code for rectificationcalibration.py
- Axiom code for reading .mat calib files and generating transformation matricestest_rectificatyion.ipynb
- Code to test Axiom routines with USACE data
write_IOEO_to_json.m
- Matlab script to convert calibrations in.mat
format to JSON files.parse_s3_inventory.ipynb
test_read_json_cal_files.ipynb
- Code to read calibration files in proposed .json format.
test_bucket_read.ipynb
- Demos using fsspec to read/write files to S3 buckets.
test_R2Calc.ipynb
- Python version of Stockdon equation.
test_time_funcs.ipynb
- Demo of datetime routines and converting file names to times.
test_histogram_balance.ipynb
- Demo of using histogram balance to better match images.