Hello,
I am currently using Isaac Sim to generate images with the same camera intrinsics as my realsense D435i camera. The camera intrinsic matrix is [606.86, 0, 321.847; 0, 606.86, 244.995; 0, 0, 1] and the image resolution is 640 * 480. Is is possible to generate images with optical center no exactly in the middle? I have tried to change the get_projection_matrix function in the helpers.py in omni.syntheticdata module, but it doesn’t seems to work.
def get_projection_matrix(fov, aspect_ratio, z_near, z_far):
“”"
Calculate the camera projection matrix.
Args:
fov (float): Field of View (in radians)
aspect_ratio (float): Image aspect ratio (Width / Height)
z_near (float): distance to near clipping plane
z_far (float): distance to far clipping plane
Returns:
(numpy.ndarray): View projection matrix with shape `(4, 4)`
"""
a = -1.0 / math.tan(fov / 2)
b = -a * aspect_ratio
c = z_far / (z_far - z_near)
d = z_near * z_far / (z_far - z_near)
offset_x = 1.847 #value addition to the x axis (positive)
offset_y = 4.995 #value addition to the y axis (positive)
tx = (offset_x * 2) / 640
ty = (offset_y * 2) / 480
tf = np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [tx, ty, 0, 1]])
projection_matrix = np.dot(np.array([[a, 0.0, 0.0, 0.0], [0.0, b, 0.0, 0.0], [0.0, 0.0, c, 1.0], [0.0, 0.0, d, 0.0]]), tf)
return projection_matrix
#np.array([[a, 0.0, 0.0, 0.0], [0.0, b, 0.0, 0.0], [0.0, 0.0, c, 1.0], [0.0, 0.0, d, 0.0]])