match_camera
Align a Blender camera to a reference photo by tuning position, rotation, roll, and field of view until the 3D model silhouette matches the target outline.
Instructions
Find the camera that shows the model like a perspective photo of the real object (for flat orthographic
views use compare_view). It tunes position, rotation, roll and field of view until the model silhouette best
matches the reference silhouette. The camera camera is created or updated and becomes the scene camera. The
answer has location, rotation, look_at, fov_deg and the IoU before and after.
Give the whole original photo, not a crop: the picture frame is the camera frame. The outline comes from alpha
or from the corner colour (plain background); threshold is the colour distance.
Start: init {"location": [x,y,z], "look_at": [x,y,z], "fov_deg": 40}, else the active perspective camera,
else 8 azimuths at 2 elevations are tried. A close start gives a better result.
fov_deg fixes the angle across the LONGER image side: a known lens is far more reliable, because distance and
field of view trade off. ground_z keeps the camera above that height. size is the working resolution;
iterations is how many times the step is halved.
A silhouette does not tell front from back on a symmetric model: check with overlay_reference. Background job:
after wait seconds the answer is a job id for job_status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| init | No | ||
| size | No | ||
| wait | No | ||
| names | No | ||
| camera | No | match_cam | |
| fov_deg | No | ||
| ground_z | No | ||
| reference | Yes | ||
| threshold | No | ||
| iterations | No | ||
| time_limit | No |