Open AlonSpinner opened 2 years ago
According to the official documentation https://dev.opencascade.org/doc/refman/html/class_graphic3d___camera.html I can't see any method to directly set the projection matrix
After a short review, I unfortunately did not find any solution
I'll try to make a workaround function SetCameraIntrinsics(fx,fy,px,py) with these:
cam.SetDistance
cam.SetFOVy
cam.SetZFocus
cam.SetZRange
cam.SetIOD
cam.SetScale
cam.SetTile
cam.SetAspect
Using : http://www.songho.ca/opengl/gl_projectionmatrix.html
def setOrthographicProjectionMatrix(cam,scale,aspect,n,f):
# P1[1,1] = aspect*2/scale
# P1[2,2] = -2/(f-n)
# P1[2,3] = -(f+n)/(f-n)
cam.SetProjectionType(cam.Projection_Orthographic)
cam.SetZRange(n,f) #affects P1[2,2] P1[3,2]
cam.SetScale(scale) #affects P1[1,1] P1[0,0]
cam.SetAspect(aspect) #affects P1[1,1] P1[0,0]
Hi again,
I'm trying to calibrate the offline renderer's camera with my own intrinsic parameters (focal length and others) Noticing that the projection matrix is in OpenGL format, I found a way to do it with this: https://strawlab.org/2011/11/05/augmented-reality-with-OpenGL/
Unfortunately, I found no set method for the camera's projection matrix. Any idea how I can go about it?
Thanks, Alon
Code to extract projection matrix from a camera object: