#ifndef pst_camera_H #define pst_camera_H /* pst_camera.h -- camera parameters and tools therefor. */ /* Last edited on 2025-02-25 14:45:08 by stolfi */ #include #include #include #include #include #include /* !!! Add radial distortion {kappa} to the parameters. !!! */ /* !!! Allow for non-square pixels. !!! */ /* MATHEMATICAL CAMERA The procedures in this interface deal with an idealized /camera/, which is essentially a mapping that projects any point {P} in some 3D space to a point {P'} on a certain /image plane/ {IPL}. For every digital photo or video frame, there is a unique camera that describes how points in physical space were mapped to points on the image. PERSPECTIVE PROJECTION At present, this interface only supports cameras that perform a restricted kind of mappint, a /conical/ (or /perspective/) projection onto a plane. We use a /nominal coordinate system/ (NCS) for 3D space whose coordinates {(X,Y,Z)} are measured in the same units (pixels, mm, whatever), and such that the image plane {IPL} is the plane with equation {Z==0}. The perspective mapping is entirely determined by its /viewpoint/ {O}, a point of 3-space (possibly infinite) that has positive {z} coordinate. From {O} we define: the /optical axis/ as the line through {O} parallel to the {Z} axis; the /optical center/ {Q} as being the point where the optical axis meets the image plane; the /focal length/ {F = O.Z = O.z/O.m}; the (/angular/) /spread/ {G} of the camera, defined as the reciprocal {1/F}; and the /view plane/ {VPL} as the plane with equation {Z==F}, parallel to {IPL} and passing through {O}. The projection of a point {P} of three-space is the point {P'} of {IPL} such that {O}, {P} and {P'} are collinear and {O} is not between {P} and {P'}. In particular, if {P} happens to lie on {IPL}, then it coincides with its projection {P'}. This point exists (and is unique) if and only if {P} lies strictly below the view plane {VPL}; that is, if {P.Z