def set_boresight_matrix_from_camera_relative_rpy_params(self, relative_roll, # type: float relative_pitch, # type: float relative_yaw, # type: float roll_units='radians', # type: str pitch_units='radians', # type: str yaw_units='radians', # type; str order='rpy', ): roll_radians = relative_roll * ureg.parse_expression(roll_units).to("radians").magnitude pitch_radians = relative_pitch * ureg.parse_expression(pitch_units).to("radians").magnitude yaw_radians = relative_yaw * ureg.parse_expression(yaw_units).to("radians").magnitude boresight_matrix = photogrammetry_utils.create_M_matrix(roll_radians, pitch_radians, yaw_radians, order=order) self.set_boresight_matrix(boresight_matrix)
def set_relative_camera_xyz( self, x_relative_to_fixture_center, # type: float y_relative_to_fixture_center, # type: float z_relative_to_fixture_center, # type: float x_units='meters', y_units='meters', z_units='meters'): x = x_relative_to_fixture_center * ureg.parse_expression(x_units) y = y_relative_to_fixture_center * ureg.parse_expression(y_units) z = z_relative_to_fixture_center * ureg.parse_expression(z_units) x_meters = x.to(ureg['meters']) y_meters = y.to(ureg['meters']) z_meters = z.to(ureg['meters']) self.x_rel_to_fixture = x_meters.magnitude self.y_rel_to_fixture = y_meters.magnitude self.z_rel_to_fixture = z_meters.magnitude
def init_from_wgs84_params( cls, sensor_lon_decimal_degrees, # type: float sensor_lat_decimal_degrees, # type: float sensor_altitude, # type: float omega, # type: float phi, # type: float kappa, # type: float npix_x, # type: int npix_y, # type: int pixel_pitch_x, # type: float pixel_pitch_y, # type: float focal_length, # type: float alt_units='meters', # type: str omega_units='radians', # type: str phi_units='radians', # type: str kappa_units='radians', # type: str pixel_pitch_x_units='micrometer', # type: str pixel_pitch_y_units='micrometer', # type: str focal_length_units='mm', # type: str flip_x=False, # type: bool flip_y=False, # type: bool ): # type: (...) -> IdealPinholeFpaLocalUtmPointCalc """ :param sensor_lon_decimal_degrees: :param sensor_lat_decimal_degrees: :param sensor_altitude: :param omega: :param phi: :param kappa: :param npix_x: :param npix_y: :param pixel_pitch_x: :param pixel_pitch_y: :param focal_length: :param alt_units: :param omega_units: :param phi_units: :param kappa_units: :param pixel_pitch_x_units: :param pixel_pitch_y_units: :param focal_length_units: :param flip_x: :param flip_y: :return: For now the altitude must be relative to the DEM used for orthorectification. For example, if the DEM is relative to the geoid, then sensor_altitude must also be relative to the geoid too. """ native_proj = proj_utils.decimal_degrees_to_local_utm_proj( sensor_lon_decimal_degrees, sensor_lat_decimal_degrees) proj_4326 = crs_defs.PROJ_4326 sensor_x_local, sensor_y_local = transform(proj_4326, native_proj, sensor_lon_decimal_degrees, sensor_lat_decimal_degrees) utm_point_calc = IdealPinholeFpaLocalUtmPointCalc() pinhole_camera = PinholeCamera() pinhole_camera.init_pinhole_from_coeffs( sensor_x_local, sensor_y_local, sensor_altitude, omega, phi, kappa, focal_length, x_units='meters', y_units='meters', z_units=alt_units, omega_units=omega_units, phi_units=phi_units, kappa_units=kappa_units, focal_length_units=focal_length_units) utm_point_calc.set_projection(native_proj) pp_x_meters = pixel_pitch_x * ureg.parse_expression( pixel_pitch_x_units) pp_y_meters = pixel_pitch_y * ureg.parse_expression( pixel_pitch_y_units) pp_x_meters = pp_x_meters.to('meters').magnitude pp_y_meters = pp_y_meters.to('meters').magnitude utm_point_calc._pixel_pitch_x_meters = pp_x_meters utm_point_calc._pixel_pitch_y_meters = pp_y_meters utm_point_calc.set_approximate_lon_lat_center(sensor_x_local, sensor_y_local) utm_point_calc._npix_x = npix_x utm_point_calc._npix_y = npix_y utm_point_calc._flip_x = flip_x utm_point_calc._flip_y = flip_y utm_point_calc._pinhole_camera = pinhole_camera return utm_point_calc
def init_from_local_params( cls, sensor_lon, # type: float sensor_lat, # type: float sensor_altitude, # type: float native_proj, # type: Proj omega, # type: float phi, # type: float kappa, # type: float npix_x, # type: int npix_y, # type: int pixel_pitch_x, # type: float pixel_pitch_y, # type: float focal_length, # type: float alt_units='meters', # type: str omega_units='radians', # type: str phi_units='radians', # type: str kappa_units='radians', # type: str pixel_pitch_x_units='micrometer', # type: str pixel_pitch_y_units='micrometer', # type: str focal_length_units='mm', # type: str flip_x=False, # type: bool flip_y=False, # type: bool ): # type: (...) -> IdealPinholeFpaLocalUtmPointCalc utm_point_calc = IdealPinholeFpaLocalUtmPointCalc() pinhole_camera = PinholeCamera() pinhole_camera.init_pinhole_from_coeffs( sensor_lon, sensor_lat, sensor_altitude, omega, phi, kappa, focal_length, x_units='meters', y_units='meters', z_units=alt_units, omega_units=omega_units, phi_units=phi_units, kappa_units=kappa_units, focal_length_units=focal_length_units) utm_point_calc.set_projection(native_proj) pp_x_meters = pixel_pitch_x * ureg.parse_expression( pixel_pitch_x_units) pp_y_meters = pixel_pitch_y * ureg.parse_expression( pixel_pitch_y_units) pp_x_meters = pp_x_meters.to('meters').magnitude pp_y_meters = pp_y_meters.to('meters').magnitude utm_point_calc._pixel_pitch_x_meters = pp_x_meters utm_point_calc._pixel_pitch_y_meters = pp_y_meters utm_point_calc.set_approximate_lon_lat_center(sensor_lon, sensor_lat) utm_point_calc._npix_x = npix_x utm_point_calc._npix_y = npix_y utm_point_calc._flip_x = flip_x utm_point_calc._flip_y = flip_y utm_point_calc._pinhole_camera = pinhole_camera return utm_point_calc
def compute_ifov_y(self, output_units="microradians"): ifov = numpy.arctan( self._pixel_pitch_y_meters / self._pinhole_camera.f) * ureg.parse_expression('radians') return ifov.to(output_units).magnitude