Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mbredif opened this issue Feb 14, 2017 · 0 comments

Comments

@mbredif
Copy link
Collaborator

mbredif commented Feb 14, 2017

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant