mirage.synth package#
Submodules#
mirage.synth.synthetic module#
- mirage.synth.synthetic.camera_rmag_limits(obj: SpaceObject) ndarray #
Generates arbitrary limits on the distance of the camera from the object, must be tweaked on a case-by-case basis. Distance is defined as a fraction of the maximum object vertex displacement
- Parameters:
obj (SpaceObject) – Object the camera will be observing (assumed to be at the origin)
- Returns:
Min and max displacement in world space units
- Return type:
np.ndarray
- mirage.synth.synthetic.generate_synthetic_dataset(obj_name: str, data_points: int = 1000, sz: int = 512, fov_deg: float = 25.0, max_phase_deg: float = 90.0, key_point_count: int = 30, clear_out_dir: bool = True, manual_key_point_selection: bool = True) None #
Generates a dataset of synthetic images for a 3D model
- Parameters:
obj_name (str) – Name of the object file
data_points (int, optional) – Number of data points (images) to generate, defaults to 1_000
sz (int, optional) – Square size of the rendered images [pix], defaults to 512
fov_deg (float, optional) – Field of view of the camera [deg], defaults to 25.0
max_phase_deg (float, optional) – Maximum phase angle between Sun and observer [deg], defaults to 90.0
key_point_count (int, optional) – Number of key points to use, defaults to 30
clear_out_dir (bool, optional) – Whether to remove everything in the output directory before generating new images, defaults to True
manual_key_point_selection (bool, optional) – Whether to let the user update key points after the initial automatic selection, defaults to True
- mirage.synth.synthetic.generate_synthetic_sequence(obj_name: str, svb: ndarray, camera_pos: ndarray, q_camera: ndarray, q_chief: ndarray, sz: int = 512, fov_deg: float = 25.0, key_point_count: int = 30, clear_out_dir: bool = True, manual_key_point_selection: bool = True) None #
- Parameters:
svb (np.ndarray [n,3]) – Sun vectors in the body frame
camera_pos (np.ndarray [n,3]) – Camera origin in the body frame
q_camera (np.ndarray [n,4]) – Camera quaternions, transforming from the target body frame to the camera frame
sz (int) – Image size (square side dimension)
fov_deg (float) – Field of view of the camera [deg]
key_point_count (int) – Number of key points to use
clear_out_dir (bool) – Whether to clear the output directory before generating new images
manual_key_point_selection (bool) – Whether to allow the user to update the initial key points
- mirage.synth.synthetic.key_model_points(obj: SpaceObject, manual_key_point_selection: bool, num_target: int = 30) ndarray #
Automatically selects key points for the input object
- Parameters:
obj (SpaceObject) – Object to operate on
manual_key_point_selection (bool) – Whether the user can update the initial selection interactively
num_target (int, optional) – Number of key points to shoot for, defaults to 30
- Returns:
Selected key points
- Return type:
np.ndarray [n,3]
- mirage.synth.synthetic.key_point_visibility(model_key_points: ndarray, sun_dir: ndarray, camera_pos: ndarray, obj: SpaceObject, kp_pix_vals: ndarray) ndarray #
Computes whether the key points are visible and illuminated
- Parameters:
model_key_points (np.ndarray [n,3]) – Key points in world space
sun_dir (np.ndarray [3,]) – Sun direction unit vector from the object in world space
camera_pos (np.ndarray [3,]) – Camera direction unit vector from the object in world space
obj (SpaceObject) – Object to operate on
kp_pix_vals (np.ndarray) – The pixel positions of the key points in the current frame,
kp_pix_vals == [-1, -1]
if the point is off the screen
- Returns:
Whether each of the key points are visible in the given illumination configuration
- Return type:
np.ndarray [n,]
- mirage.synth.synthetic.model_parameters(obj: SpaceObject, key_point_count: int, manual_key_point_selection: bool) Tuple[ndarray, Tuple] #
Generates the model key points and camera distance limits
- Parameters:
obj (SpaceObject) – Object to use
key_point_count (int) – Number of key points to shoot for, often it will not be achieved exactly
manual_key_point_selection (bool) – Whether to allow the user to update the initial key points
- Returns:
Key points and camera distance limits
- Return type:
Tuple[np.ndarray, Tuple]
- mirage.synth.synthetic.order_key_points(key_points: ndarray) ndarray #
Orders the key points in ascending \(z\) order
- Parameters:
key_points (np.ndarray [n,3]) – Key points to order
- Returns:
Key points vector, rearranged into order by \(z\) component
- Return type:
np.ndarray [n,3]
- mirage.synth.synthetic.random_camera_params(fov_deg: float, vmag_max: float, cam_r_lims: Tuple[float, float], data_points: int) Tuple[ndarray, ndarray] #
Gemnerates random camera positions and look points
- Parameters:
fov_deg (float) – Field of view of the camera [deg]
vmag_max (float) – Maximum distance of the object from the center of the frame
cam_r_lims (Tuple[float, float]) – Minimum and maximum distance of the camera from the object
data_points (int) – Number of random data points to generate
- Returns:
Camera positions, camera look points
- Return type:
Tuple[np.ndarray, np.ndarray]
- mirage.synth.synthetic.zip_directory(dir_to_zip: str, file_path: str) None #
Zips a directory into an archive
- Parameters:
dir_to_zip (str) – Directory path to zip
file_path (str) – Name of the output zip archive, saved in the same parent directory