clean up SFMdata
							parent
							
								
									52161785cf
								
							
						
					
					
						commit
						67403b0e96
					
				|  | @ -5,36 +5,39 @@ A structure-from-motion example with landmarks | ||||||
| """ | """ | ||||||
| # pylint: disable=invalid-name, E1101 | # pylint: disable=invalid-name, E1101 | ||||||
| 
 | 
 | ||||||
|  | from typing import List | ||||||
|  | 
 | ||||||
| import numpy as np | import numpy as np | ||||||
| 
 | 
 | ||||||
| import gtsam | import gtsam | ||||||
|  | from gtsam import Cal3_S2, Point3, Pose3 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def createPoints(): | def createPoints() -> List[Point3]: | ||||||
|     # Create the set of ground-truth landmarks |     # Create the set of ground-truth landmarks | ||||||
|     points = [gtsam.Point3(10.0, 10.0, 10.0), |     points = [ | ||||||
|               gtsam.Point3(-10.0, 10.0, 10.0), |         Point3(10.0, 10.0, 10.0), | ||||||
|               gtsam.Point3(-10.0, -10.0, 10.0), |         Point3(-10.0, 10.0, 10.0), | ||||||
|               gtsam.Point3(10.0, -10.0, 10.0), |         Point3(-10.0, -10.0, 10.0), | ||||||
|               gtsam.Point3(10.0, 10.0, -10.0), |         Point3(10.0, -10.0, 10.0), | ||||||
|               gtsam.Point3(-10.0, 10.0, -10.0), |         Point3(10.0, 10.0, -10.0), | ||||||
|               gtsam.Point3(-10.0, -10.0, -10.0), |         Point3(-10.0, 10.0, -10.0), | ||||||
|               gtsam.Point3(10.0, -10.0, -10.0)] |         Point3(-10.0, -10.0, -10.0), | ||||||
|  |         Point3(10.0, -10.0, -10.0), | ||||||
|  |     ] | ||||||
|     return points |     return points | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def createPoses(K): | def createPoses(K: Cal3_S2) -> List[Pose3]: | ||||||
|     # Create the set of ground-truth poses |     """Generate a set of ground-truth camera poses arranged in a circle about the origin.""" | ||||||
|     radius = 40.0 |     radius = 40.0 | ||||||
|     height = 10.0 |     height = 10.0 | ||||||
|     angles = np.linspace(0, 2*np.pi, 8, endpoint=False) |     angles = np.linspace(0, 2 * np.pi, 8, endpoint=False) | ||||||
|     up = gtsam.Point3(0, 0, 1) |     up = gtsam.Point3(0, 0, 1) | ||||||
|     target = gtsam.Point3(0, 0, 0) |     target = gtsam.Point3(0, 0, 0) | ||||||
|     poses = [] |     poses = [] | ||||||
|     for theta in angles: |     for theta in angles: | ||||||
|         position = gtsam.Point3(radius*np.cos(theta), |         position = gtsam.Point3(radius * np.cos(theta), radius * np.sin(theta), height) | ||||||
|                                 radius*np.sin(theta), |  | ||||||
|                                 height) |  | ||||||
|         camera = gtsam.PinholeCameraCal3_S2.Lookat(position, target, up, K) |         camera = gtsam.PinholeCameraCal3_S2.Lookat(position, target, up, K) | ||||||
|         poses.append(camera.pose()) |         poses.append(camera.pose()) | ||||||
|     return poses |     return poses | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue