CV Camera Pose To 3D View
Adapts an OpenCV camera model to the LOAD3D_CAMERA dict the native 3D preview nodes take ('Preview 3D (Advanced)' / 'Preview Splat' / 'Preview Point Cloud' camera_info input), so a calibrated real camera drives the Three.js viewer camera. Feed the intrinsic matrix from 'Calibrate Camera (Chessboard)' or 'CV Load Camera Params (JSON)' and the extrinsics (rvec/tvec) from 'CV Solve PnP (Pose)': the viewer camera is placed at the physical camera's position relative to the board/object, looking down its optical axis. Coordinates are converted from OpenCV (right-handed, Y down, camera looks +Z) to Three.js (right-handed, Y up, camera looks -Z) by negating Y and Z. The orbit target is the point on the optical axis nearest orbit_anchor, so OrbitControls' lookAt reproduces the pose's viewing direction exactly (camera roll is lost - OrbitControls keeps +Y up). fov/aspect/quaternion are filled from the intrinsics per the LOAD3D_CAMERA spec, but the current frontend applies only position/target/zoom from a camera_info input - the viewer keeps its own FOV. Failure-tolerant: without rvec/tvec (or with the zero vectors Solve PnP emits on found=false) the camera falls back to a front view of orbit_anchor at 10*scale distance.
- camera_matrix
- rvec
- tvec
- orbit_anchor
- dist_coeffs
- camera_info
- fov_y_deg
- distance
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| camera_matrix | NPARRAY | 3x3 intrinsic matrix K ('Calibrate Camera', 'CV Load Camera Params' or 'CV Camera Matrix'). Sets the reported vertical FOV: fov_y = 2*atan(image_height / (2*fy)). | |
| rvecopt | NPARRAY | 3x1 Rodrigues rotation vector from 'CV Solve PnP (Pose)' (a 3x3 rotation matrix is also accepted). Leave unconnected for a frontal default view. | |
| tvecopt | NPARRAY | 3x1 translation vector from 'CV Solve PnP (Pose)'. Leave unconnected for a frontal default view. | |
| orbit_anchoropt | NPARRAY | 3D point (in the SAME object/world coordinates as the solve-PnP object points, e.g. the board centre from 'CV Points' [[4, 2.5, 0]]) that the orbit pivot should sit nearest to. The target is its projection onto the optical axis, so orbiting rotates around the observed object. Default: the object-space origin. | |
| dist_coeffsopt | NPARRAY | Lens distortion coefficients (k1, k2, p1, p2[, k3]) from 'Calibrate Camera' / 'CV Load Camera Params'. Rides along in the dict (_dist_coeffs) for viewers that can render distortion ('CV Preview 3D (Calibrated Camera)'); the core preview nodes ignore it. | |
| image_widthopt | INT | 00–100000 | Calibration image width in px, for the aspect ratio. 0 = estimate as 2*cx from the camera matrix. |
| image_heightopt | INT | 00–100000 | Calibration image height in px, for the vertical FOV. 0 = estimate as 2*cy from the camera matrix. |
| scaleopt | FLOAT | 1.000.000001–1000000 | Multiplier from object units (e.g. chessboard squares or mm) to 3D scene units, applied to the camera position and orbit target. Use it to size the camera distance to the previewed model. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| camera_info | LOAD3D_CAMERA | LOAD3D_CAMERA dict (position/target/zoom/cameraType + quaternion/fov/aspect/near/far) - wire into the camera_info input of 'Preview 3D (Advanced)', 'Preview Splat' or 'Preview Point Cloud'. |
| fov_y_deg | FLOAT | Vertical field of view implied by the intrinsics, in degrees (2*atan(h/(2*fy))). |
| distance | FLOAT | Camera-to-target distance in scene units (after scale). |