@@ -42,15 +42,16 @@ class CamerasBase(TensorProperties):
42
42
43
43
It defines methods that are common to all camera models:
44
44
- `get_camera_center` that returns the optical center of the camera in
45
- world coordinates
45
+ world coordinates
46
46
- `get_world_to_view_transform` which returns a 3D transform from
47
- world coordinates to the camera view coordinates (R, T)
47
+ world coordinates to the camera view coordinates (R, T)
48
48
- `get_full_projection_transform` which composes the projection
49
- transform (P) with the world-to-view transform (R, T)
49
+ transform (P) with the world-to-view transform (R, T)
50
50
- `transform_points` which takes a set of input points in world coordinates and
51
- projects to NDC coordinates ranging from [-1, -1, znear] to [+1, +1, zfar].
51
+ projects to NDC coordinates ranging from [-1, -1, znear] to [+1, +1, zfar].
52
52
- `transform_points_screen` which takes a set of input points in world coordinates and
53
- projects them to the screen coordinates ranging from [0, 0, znear] to [W-1, H-1, zfar]
53
+ projects them to the screen coordinates ranging from
54
+ [0, 0, znear] to [W-1, H-1, zfar]
54
55
55
56
For each new camera, one should implement the `get_projection_transform`
56
57
routine that returns the mapping from camera view coordinates to NDC coordinates.
@@ -268,6 +269,12 @@ def clone(self):
268
269
other = cam_type (device = self .device )
269
270
return super ().clone (other )
270
271
272
+ def is_perspective (self ):
273
+ raise NotImplementedError ()
274
+
275
+ def get_znear (self ):
276
+ return self .znear if hasattr (self , "znear" ) else None
277
+
271
278
272
279
############################################################
273
280
# Field of View Camera Classes #
@@ -534,6 +541,9 @@ def unproject_points(
534
541
unprojection_transform = to_ndc_transform .inverse ()
535
542
return unprojection_transform .transform_points (xy_sdepth )
536
543
544
+ def is_perspective (self ):
545
+ return True
546
+
537
547
538
548
def OpenGLOrthographicCameras (
539
549
znear = 1.0 ,
@@ -752,6 +762,9 @@ def unproject_points(
752
762
unprojection_transform = to_ndc_transform .inverse ()
753
763
return unprojection_transform .transform_points (xy_sdepth )
754
764
765
+ def is_perspective (self ):
766
+ return False
767
+
755
768
756
769
############################################################
757
770
# MultiView Camera Classes #
@@ -927,6 +940,9 @@ def unproject_points(
927
940
)
928
941
return unprojection_transform .transform_points (xy_inv_depth )
929
942
943
+ def is_perspective (self ):
944
+ return True
945
+
930
946
931
947
def SfMOrthographicCameras (
932
948
focal_length = 1.0 , principal_point = ((0.0 , 0.0 ),), R = _R , T = _T , device = "cpu"
@@ -1086,6 +1102,9 @@ def unproject_points(
1086
1102
unprojection_transform = to_ndc_transform .inverse ()
1087
1103
return unprojection_transform .transform_points (xy_depth )
1088
1104
1105
+ def is_perspective (self ):
1106
+ return False
1107
+
1089
1108
1090
1109
################################################
1091
1110
# Helper functions for cameras #
0 commit comments