@@ -16,7 +16,7 @@ def test_parameters(self):
1616
1717 c = CentralCamera (f = 0.2 )
1818 nt .assert_array_almost_equal (c .f , (0.2 , 0.2 ))
19- self .assertEqual (c .camtype , ' perspective' )
19+ self .assertEqual (c .camtype , " perspective" )
2020 self .assertEqual (c .fu , 0.2 )
2121 self .assertEqual (c .fv , 0.2 )
2222
@@ -71,15 +71,15 @@ def test_parameters(self):
7171 self .assertEqual (c .u0 , 200 )
7272 self .assertEqual (c .v0 , 300 )
7373 nt .assert_array_almost_equal (c .pp , (200 , 300 ))
74-
74+
7575 # Test setting focal length
7676 c = CentralCamera (f = 0.015 )
7777 try :
7878 c .f = 0.02
7979 self .assertAlmostEqual (c .f [0 ], 0.02 )
8080 except :
8181 pass
82-
82+
8383 # Test setting principal point
8484 try :
8585 c .pp = (400 , 300 )
@@ -93,21 +93,21 @@ def test_pose(self):
9393 c = CentralCamera ()
9494 self .assertTrue (c .pose == SE3 ())
9595
96- x = SE3 (1 ,2 , 3 )
97- y = SE3 (4 ,5 , 6 )
98-
96+ x = SE3 (1 , 2 , 3 )
97+ y = SE3 (4 , 5 , 6 )
98+
9999 # Test setting pose
100100 c .pose = x
101101 self .assertTrue (c .pose == x )
102-
102+
103103 # Test different pose
104104 c .pose = y
105105 self .assertTrue (c .pose == y )
106-
106+
107107 def test_project_point (self ):
108108 """Test projecting 3D points to image plane"""
109109 c = CentralCamera (f = 0.015 , rho = 10e-6 , imagesize = [1280 , 1024 ])
110-
110+
111111 # Project a single point
112112 try :
113113 P = np .array ([0.1 , 0.2 , 3.0 ])
@@ -116,55 +116,55 @@ def test_project_point(self):
116116 except :
117117 # Method might not exist
118118 pass
119-
119+
120120 # Project multiple points
121121 try :
122122 P_multi = np .array ([[0.1 , 0.2 , 0.3 ], [0.2 , 0.3 , 0.4 ], [3.0 , 3.0 , 3.0 ]]).T
123123 p_multi = c .project_point (P_multi )
124124 self .assertEqual (p_multi .shape [1 ], 3 )
125125 except :
126126 pass
127-
127+
128128 def test_K_matrix (self ):
129129 """Test camera calibration matrix"""
130130 c = CentralCamera (f = 0.015 , rho = 10e-6 , imagesize = [1280 , 1024 ], pp = (640 , 512 ))
131131 K = c .K
132-
132+
133133 # Check shape
134134 self .assertEqual (K .shape , (3 , 3 ))
135-
135+
136136 # Check that K is upper triangular (mostly)
137137 self .assertNotEqual (K [0 , 0 ], 0 ) # fu
138138 self .assertNotEqual (K [1 , 1 ], 0 ) # fv
139139 self .assertNotEqual (K [0 , 2 ], 0 ) # u0
140140 self .assertNotEqual (K [1 , 2 ], 0 ) # v0
141- self .assertEqual (K [2 , 2 ], 1.0 ) # Bottom right should be 1
142-
141+ self .assertEqual (K [2 , 2 ], 1.0 ) # Bottom right should be 1
142+
143143 def test_C_matrix (self ):
144144 """Test camera matrix"""
145145 c = CentralCamera (f = 0.015 , rho = 10e-6 )
146146 C = c .C ()
147-
147+
148148 # Check shape
149149 self .assertEqual (C .shape , (3 , 4 ))
150-
150+
151151 def test_different_camera_types (self ):
152152 """Test different camera models"""
153153 # Perspective camera
154154 c_persp = CentralCamera (f = 0.015 )
155- self .assertEqual (c_persp .camtype , ' perspective' )
156-
155+ self .assertEqual (c_persp .camtype , " perspective" )
156+
157157 # Test camera with distortion parameters
158158 try :
159159 c_dist = CentralCamera (f = 0.015 , distortion = [0.1 , 0.01 ])
160160 self .assertIsNotNone (c_dist .distortion )
161161 except :
162162 pass
163-
163+
164164 def test_ray_direction (self ):
165165 """Test computing ray directions"""
166166 c = CentralCamera (f = 0.015 , rho = 10e-6 , imagesize = [1280 , 1024 ])
167-
167+
168168 try :
169169 # Test getting ray for a pixel
170170 ray = c .ray ([640 , 512 ])
@@ -173,12 +173,12 @@ def test_ray_direction(self):
173173 except :
174174 # Method might not exist
175175 pass
176-
176+
177177 @unittest .skip ("move method doesn't work as expected" )
178178 def test_move_camera (self ):
179179 """Test moving camera in space"""
180180 c = CentralCamera ()
181-
181+
182182 # Move camera
183183 T = SE3 (1 , 2 , 3 )
184184 try :
@@ -200,20 +200,20 @@ def test_move_camera(self):
200200 self .assertTrue (c2 .pose == x )
201201
202202 def test_str (self ):
203- c = CentralCamera (f = 0.123 , imagesize = (2000 , 3000 ), name = ' fred' )
203+ c = CentralCamera (f = 0.123 , imagesize = (2000 , 3000 ), name = " fred" )
204204 s = str (c )
205205 self .assertIsInstance (s , str )
206- self .assertTrue (' fred' in s )
207- self .assertTrue (' CentralCamera' in s )
208- self .assertTrue (' 2000' in s )
209- self .assertTrue (' 3000' in s )
210- self .assertTrue (' 0.123' in s )
206+ self .assertTrue (" fred" in s )
207+ self .assertTrue (" CentralCamera" in s )
208+ self .assertTrue (" 2000" in s )
209+ self .assertTrue (" 3000" in s )
210+ self .assertTrue (" 0.123" in s )
211211
212212 def test_project (self ):
213213
214214 c = CentralCamera (f = 1 , rho = 1 , pp = (0 , 0 ))
215215 p = c .project_point ([0 , 0 , 5 ])
216- self .assertTrue (p .shape == (2 ,1 ))
216+ self .assertTrue (p .shape == (2 , 1 ))
217217 nt .assert_array_almost_equal (p .flatten (), [0 , 0 ])
218218
219219 p = c .project_point ([1 , 0 , 5 ])
@@ -243,7 +243,7 @@ def test_project(self):
243243 p = c .project_point ([1 , - 1 , 5 ], objpose = SE3 (- 1 , 1 , 0 ))
244244 nt .assert_array_almost_equal (p .flatten (), [0 , 0 ])
245245
246- c = CentralCamera (f = 1 , rho = 1 , pp = (1 ,1 ))
246+ c = CentralCamera (f = 1 , rho = 1 , pp = (1 , 1 ))
247247
248248 p = c .project_point ([0 , - 1 , 5 ])
249249 nt .assert_array_almost_equal (p .flatten (), [1 , 0.8 ])
@@ -288,62 +288,62 @@ def test_plucker(self):
288288
289289 line = c .ray (p )
290290 self .assertTrue (line .contains (P ))
291-
291+
292292 def test_camera_attributes_access (self ):
293293 """Test accessing various camera attributes"""
294294 c = CentralCamera (f = 0.015 , rho = 10e-6 , imagesize = [1280 , 1024 ], pp = (640 , 512 ))
295-
295+
296296 # Test accessing imaging plane size
297297 self .assertEqual (c .width , 1280 )
298298 self .assertEqual (c .height , 1024 )
299-
299+
300300 # Test pixel size
301301 self .assertEqual (c .rhou , 10e-6 )
302302 self .assertEqual (c .rhov , 10e-6 )
303-
303+
304304 def test_camera_pose_transformations (self ):
305305 """Test camera pose and transformation"""
306306 c = CentralCamera ()
307-
307+
308308 # Initial pose
309309 initial_pose = c .pose
310310 self .assertTrue (isinstance (initial_pose , SE3 ))
311-
311+
312312 # Set new pose
313313 new_pose = SE3 (0.5 , 0.5 , 0.5 )
314314 c .pose = new_pose
315315 self .assertTrue (c .pose == new_pose )
316-
316+
317317 def test_camera_matrix_access (self ):
318318 """Test accessing camera matrices"""
319319 c = CentralCamera (f = 0.015 , rho = 10e-6 , pp = (640 , 512 ))
320-
320+
321321 try :
322322 # K matrix
323323 K = c .K
324324 self .assertEqual (K .shape , (3 , 3 ))
325325 self .assertEqual (K [2 , 2 ], 1.0 )
326326 except :
327327 pass
328-
328+
329329 try :
330330 # C matrix
331331 C = c .C ()
332332 self .assertEqual (C .shape , (3 , 4 ))
333333 except :
334334 pass
335-
335+
336336 try :
337- # P matrix
337+ # P matrix
338338 P = c .P ()
339339 self .assertEqual (P .shape , (3 , 4 ))
340340 except :
341341 pass
342-
342+
343343 def test_camera_clone_methods (self ):
344344 """Test camera cloning/copying"""
345345 c = CentralCamera (f = 0.015 , pose = SE3 (1 , 2 , 3 ))
346-
346+
347347 try :
348348 # Some way to clone the camera
349349 c_copy = CentralCamera (f = 0.015 , pose = c .pose )
@@ -353,6 +353,6 @@ def test_camera_clone_methods(self):
353353
354354
355355# ----------------------------------------------------------------------- #
356- if __name__ == ' __main__' :
356+ if __name__ == " __main__" :
357357
358- unittest .main ()
358+ unittest .main ()
0 commit comments