0

Is it possible to get principal point (cx, cy) from a 4x4 projection matrix? This is the same matrix asked in this question: Getting focal length and focal point from a projection matrix

  (SCNMatrix4) 
   s = (m11 = 1.83226573, 
   m12 = 0, 
   m13 = 0, 
   m14 = 0,
   m21 = 0,
   m22 = 2.44078445,
   m23 = 0,
   m24 = 0,
   m31 = -0.00576340035, 
   m32 = -0.0016724075, 
   m33 = -1.00019991, 
   m34 = -1, 
   m41 = 0, 
   m42 = 0, 
   m43 = -0.20002, 
   m44 = 0)

The values I'm trying to calculate in this 3x3 camera matrix is x0 and y0.

RJK
  • 195
  • 1
  • 2
  • 18
  • so you got 3x3 or 4x4 matrix? Also it depends on what kind of projection matrix you got (there are more of them out there). the QA you linked is the `gluPerspective` from GLU and you can extract all the info from it directly using algebra. Also is the matrix just a projection or its also mixed with other transforms? There are also non algebraic approaches how to obtain the parameters from arbitrary matrix just find 2 different lines such their endpoints are projected to the same position using fitting or search and then just compute their intersection that will give you focal point ... – Spektre Mar 20 '19 at 09:20
  • if you have projection with offset then your projection was multiplied most likely by translation matrix at some point from left or right so the `cx,cy,cz` would most likely be in the matrix `origin(x0,y0,z0)` part [Understanding 4x4 homogenous transform matrices](https://stackoverflow.com/a/28084380/2521214) or in its the inverse form ...also look at [OpenGL ray OBB intersection](https://stackoverflow.com/a/52905600/2521214) look for functions `world2scr` and `scr2world` as they use projection matrix parameters ... to map between 3D world and 2D screen position back and forward – Spektre Mar 20 '19 at 10:12
  • @Spektre I have a 4x4 projection matrix. It is just a projection and not mixed with transforms. The matrixes I am using is from a three.ar.js wrapper that extends WebVR API (https://immersive-web.github.io/webvr/spec/1.1/#vrframedata-attributes). I believe the focal point is the the value at [0][0] in my matrix. But I am trying to find out the principal point (cx, cy). Thanks for your direction. I'll look into the documentation. – RJK Mar 20 '19 at 15:48
  • and what exactly is the principal point in your definition ? – Spektre Mar 20 '19 at 16:51
  • https://immersive-web.github.io/webvr/spec/1.1/#vreyeparameters-attributes the offset listed here is pretty much what i am trying to get as the principal point: ```vector from the center point of the headset to the center point of the lens for the given eye```, the problem is offset is either deprecated or not supported anymore since I get a vector of (0, 0, 0) when I try to get the offset. I thought it would help to go backwards and derive the principal point from the perspective projection matrix. – RJK Mar 20 '19 at 16:58
  • so you want offset from center for each eye/camera ... do you got both left and right matrices of the same headset situation? the differing elements will be holding most likely your offset .. if its length is approx ~6.5cm/2 then its directly offset if not then its multiplicated with the original matrix and you need to decode ... – Spektre Mar 20 '19 at 17:09
  • I have both left and right projection matrices and left and right view matrices. The differing elements with the projection matrices is the offset? If my headset is not a headset, but is a phone, would the matrices be the same and the principal point is 0,0? – RJK Mar 20 '19 at 17:16
  • it depends on actual implementation that is used but more or less yes, **but both projections must be parallel to each** otherwise the other elements would change too ... – Spektre Mar 20 '19 at 20:41

0 Answers0