Upload examples/quickstart.py
Browse files1234567891011121314151617181920212223242526272829"""Quick-start: single image → metric depth → point cloud in 10 lines."""
from pathlib import Pathfrom depthpro_wrapper import ( DepthProEstimator, rgbd_to_point_cloud, save_point_cloud,)
# 1. Load estimator (downloads ~2 GB weights on first run)estimator = DepthProEstimator(device="cuda:0")
# 2. Estimate depthresult = estimator.estimate("photo.jpg")print(f"Focal length: {result.focal_length:.1f} px")print(f"Depth range: {result.depth.min():.2f} – {result.depth.max():.2f} m")
# 3. Back-project to coloured point cloudpoints, colors = rgbd_to_point_cloud( result.depth, result.image, result.focal_length,)
# 4. Savesave_point_cloud("output.ply", points, colors=colors)print(f"Saved {len(points):,} points to output.ply")examples/quickstart.pyAdded+29