Skip to content

Commit

Permalink
added gsd param for hirise step 5 in notebook to allow for downsampli…
Browse files Browse the repository at this point in the history
…ng, added max_ba_iterations param for hirise, fixed other todo to use gdal_translate
  • Loading branch information
AndrewAnnex committed Jun 28, 2021
1 parent b688fe4 commit 17e9cd8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 3 additions & 1 deletion asap_stereo/asap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ def generate_hirise_pair_list(self, one, two):
o.write('\n')

@staticmethod
def notebook_pipeline_make_dem(left: str, right: str, config: str, refdem: str, maxdisp: float = None, downsample: int = None, demgsd: float = 1.0, imggsd: float = 0.25, alignment_method = 'rigid', working_dir ='./', out_notebook=None, **kwargs):
def notebook_pipeline_make_dem(left: str, right: str, config: str, refdem: str, maxdisp: float = None, downsample: int = None, demgsd: float = 1.0, imggsd: float = 0.25, max_ba_iterations: int = 50, alignment_method = 'rigid', working_dir ='./', out_notebook=None, **kwargs):
"""
First step in HiRISE DEM pipeline that uses papermill to persist log
Expand All @@ -1187,6 +1187,7 @@ def notebook_pipeline_make_dem(left: str, right: str, config: str, refdem: str,
:param maxdisp: Maximum expected displacement in meters, specify none to determine it automatically
:param demgsd: desired GSD of output DEMs (4x image GSD)
:param imggsd: desired GSD of output ortho images
:param max_ba_iterations: maximum number of BA steps to use per run (defaults to 50 for slow running hirise BA)
"""
if not out_notebook:
out_notebook = f'{working_dir}/log_asap_notebook_pipeline_make_dem_hirise.ipynb'
Expand All @@ -1204,6 +1205,7 @@ def notebook_pipeline_make_dem(left: str, right: str, config: str, refdem: str,
'imggsd' : imggsd,
'alignment_method': alignment_method,
'downsample': downsample,
'max_ba_iterations': max_ba_iterations,
},
request_save_on_cell_execute=True,
**kwargs
Expand Down
16 changes: 7 additions & 9 deletions asap_stereo/asap_hirise_workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"img_gsd = 0.25\n",
"alignment_method = 'rigid'\n",
"output_path = None\n",
"downsample = None"
"downsample = None\n",
"max_ba_iterations = 50"
]
},
{
Expand Down Expand Up @@ -244,8 +245,7 @@
"heading_collapsed": true
},
"source": [
"# Cam2map4Stereo (Step 5)\n",
"todo: if downsampled is not None, pass in img_gsd to step five otherwise allow asp cam2map4stereo work it out"
"# Cam2map4Stereo (Step 5)"
]
},
{
Expand All @@ -256,7 +256,7 @@
},
"outputs": [],
"source": [
"!asap hirise step-five 2>&1 | tee -i -a ./5_cam2map.log ./full_log.log"
"!asap hirise step-five --gsd {img_gsd if downsample else None} 2>&1 | tee -i -a ./5_cam2map.log ./full_log.log"
]
},
{
Expand All @@ -276,7 +276,7 @@
},
"outputs": [],
"source": [
"!asap hirise step-six --max-iterations 50 2>&1 | tee -i -a ./6_bundle_adjust.log ./full_log.log"
"!asap hirise step-six --max-iterations {max_ba_iterations} 2>&1 | tee -i -a ./6_bundle_adjust.log ./full_log.log"
]
},
{
Expand Down Expand Up @@ -460,9 +460,7 @@
"cell_type": "markdown",
"source": [
"### Visualize the ipmatch debug image\n",
"to see how good the hill shade align was, if it's bad modify step 10 below to not use the initial transform.\n",
"\n",
"todo: convert below to use gdal_translate"
"to see how good the hill shade align was, if it's bad modify step 10 below to not use the initial transform.\n"
],
"metadata": {
"collapsed": false
Expand All @@ -473,7 +471,7 @@
"execution_count": null,
"outputs": [],
"source": [
"!convert ./*/results_ba/hillshade_align/out-reference__source.tif ./ipd.png"
"!gdal_translate -of PNG ./*/results_ba/hillshade_align/out-reference__source.tif ./ipd.png"
],
"metadata": {
"collapsed": false,
Expand Down

0 comments on commit 17e9cd8

Please sign in to comment.