Hello Alexey,
Thank you for the suggestions. I have tried to implement the exception with limited results. I think I need clarification on where exactly to integrate the code.
I'm assuming your code is meant to replace lines 275-279 and/or 283-288 (shown in the attached screenshot). I have tried doing so in both locations together and separate.
The reason I say I have had limited success is because the result is the creation of all of the split chunks (16 in my case, 4x4), they are just empty (i.e. no dense cloud). I can use these in the batch processing tool like normal, so that is a possibility, albeit not an ideal solution. However, the Build Dense Cloud option within the script no longer works as it is just bypassed. While I do now have a workaround, I'm just curious if I can get this working smoothly...
Can you please clarify what lines you think I should be replacing or inserting and where??
Thank you!
Options I have tried:
1: replacing the statement in after "else"
if buildDense:
if new_chunk.depth_maps:
reuse_depth = True
if new_chunk.depth_maps.meta['depth/depth_downscale']:
quality = QUALITY[new_chunk.depth_maps.meta['depth/depth_downscale']]
if new_chunk.depth_maps.meta['depth/depth_filter_mode']:
filtering = FILTERING[new_chunk.depth_maps.meta['depth/depth_filter_mode']]
try:
new_chunk.buildDepthMaps(quality=quality, filter=filtering, reuse_depth=reuse_depth)
new_chunk.buildDenseCloud(max_neighbors=100) # keep_depth=False
except RuntimeError:
print("Can't build dense cloud for " + chunk.label)
else:
reuse_depth = False
try:
chunk.buildDenseCloud()
except Exception as exc:
print("Something wrong for chunk ", chunk.label, ". Skipped error: ",exc)
2 replacing the first "try" statement
if buildDense:
if new_chunk.depth_maps:
reuse_depth = True
if new_chunk.depth_maps.meta['depth/depth_downscale']:
quality = QUALITY[new_chunk.depth_maps.meta['depth/depth_downscale']]
if new_chunk.depth_maps.meta['depth/depth_filter_mode']:
filtering = FILTERING[new_chunk.depth_maps.meta['depth/depth_filter_mode']]
try:
chunk.buildDenseCloud()
except Exception as exc:
print("Something wrong for chunk ", chunk.label, ". Skipped error: ",exc)
else:
reuse_depth = False
try:
new_chunk.buildDepthMaps(quality=quality,
filter=Metashape.FilterMode.AggressiveFiltering, reuse_depth=reuse_depth)
new_chunk.buildDenseCloud(max_neighbors=100) # keep_depth=False
except RuntimeError:
print("Can't build dense cloud for " + chunk.label)
3 replacing both "try" statements
if buildDense:
if new_chunk.depth_maps:
reuse_depth = True
if new_chunk.depth_maps.meta['depth/depth_downscale']:
quality = QUALITY[new_chunk.depth_maps.meta['depth/depth_downscale']]
if new_chunk.depth_maps.meta['depth/depth_filter_mode']:
filtering = FILTERING[new_chunk.depth_maps.meta['depth/depth_filter_mode']]
try:
chunk.buildDenseCloud()
except Exception as exc:
print("Something wrong for chunk ", chunk.label, ". Skipped error: ",exc)
else:
reuse_depth = False
try:
chunk.buildDenseCloud()
except Exception as exc:
print("Something wrong for chunk ", chunk.label, ". Skipped error: ",exc)