Skip to content

PC_Perspective(pcpatch/pcpoint, float[16]) : pcpatch/pcpoint and specializations #46

@mbredif

Description

@mbredif

This is the most general perspective transform with 16 parameters.

Interesting specialization could be implemented in C or SQL :

  • PC_ProjectPinhole
fx, s, cx, 0
0, fy, cy, 0
0, 0, 0, 1
0, 0, 1, 0

fx and fy are the focal lengths expressed in horizontal and vertical pixel sizes, cx and cy are the pixel coordinates of the optical axis, s is the amount of shearing). Usually, fx=fy, (cx,cy) is close to the image center and s=0. It takes a metric 3D point where the x axis is along the image rows, the y axis along the image columns and the z axis along the optical axis, and outputs a point (c,r,d) where (c,r) are the column and row coordinates in pixels and d is 1/depth along the optical axis (d=0 for a point at infinity and d>0 for points in front of the camera

  • PC_UnprojectPinhole (the inverse of the above)
fy, -s, 0, cy.s-cx.fy
0, fx, 0, -cy.fx
0, 0, 0, fx.fy
0, 0, fx.fy, 0
  • PC_Scale
sx, 0, 0, 0
0, sy, 0, 0
0, 0, sz, 0
0, 0, 0, 1
  • PC_TransScale
sx, 0, 0, tx
0, sy, 0, ty
0, 0, sz, tz
0, 0, 0, 1
  • PC_RotateX
  • PC_RotateY
  • PC_RotateZ
  • PC_RotateQuaternionUnnormalized (works even if quaternion (x,y,z,w) is not normalized)
 x*x-y*y-z*z+w*w, 2*x*y-2*z*w, 2*x*z+2*y*w, 0
2*x*y+2*z*w, -x*x+y*y-z*z+w*w, 2*y*z-2*x*w, 0
2*x*z-2*y*w, 2*y*z+2*x*w,-x*x-y*y+z*z+w*w, 0
0,0,0,x*x+y*y+z*z+w*w

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions