Agisoft Metashape
Agisoft Metashape => Python and Java API => Topic started by: aaronfhd on June 22, 2021, 07:56:40 PM
-
I am Trying to Figure out how Agisoft determines that distance in the 32bit tiff it exports.
I have a Tree known distance in Agisoft from camera which is 160 meters away. But in the 32bit image in Band 1 the pixel value is 58.
How can I get those matching am I missing something. Thanks.
-
Hello aaronfhd,
Please check the example in the similar thread, which describes, how the depth data can be scaled to the real world dimensions (for faster script work numpy module is required):
https://www.agisoft.com/forum/index.php?topic=11171.msg50351#msg50351
-
Here is the code that I have. Where would I multiply it
def render_depth():
print("Script started...")
chunk = Metashape.app.document.chunk
#if not chunk.model:
#raise Exception("No model!")
for camera in get_cameras(chunk):
render = chunk.dense_cloud.renderDepth(camera.transform, camera.sensor.calibration,point_size=4, resolution=1, cull_points=False, add_alpha=False)
photo_dir = os.path.dirname(camera.photo.path) + "/workspace/depth/"
photo_filename = os.path.basename(camera.photo.path)
render_filename = os.path.splitext(photo_filename)[0] + "_render.tif"
render.save(os.path.join(photo_dir, render_filename))
-
Hello aaronfhd,
Please try the following modification:
chunk = Metashape.app.document.chunk
if chunk.transform:
scale = chunk.transform.scale
else:
scale = 1
for camera in get_cameras(chunk):
if not camera.transform:
continue
render = chunk.dense_cloud.renderDepth(camera.transform, camera.sensor.calibration,point_size=4, resolution=1, cull_points=False, add_alpha=False)
render = scale * render
#...