def convertToOpenGLCameraMatrix(K, framebufferSize, near, far):
""" Convert a camera calibration matrix into OpenGL format. """
width, height = framebufferSize
# print 'framebufferSize:', framebufferSize
fx = K[0,0]
fy = K[1,1]
fovy = 2*np.arctan(0.5*height/fy)#*180/np.pi
aspect = (width*fy)/(height*fx)
# define the near and far clipping planes
# near = 0.1
# far = 100.0
# fx = 10.0
# fy = 10.0
# fovy = 90*(np.pi/180.0)
# aspect = (width*fy)/(height*fx)
proj = openGLPerspectiveMatrix(fovy,aspect,near,far)
return proj
评论列表
文章目录