Spacecraft Control Framework 1.0
Spacecraft Control Library
Files | Classes | Typedefs | Functions
Optics

Optics, image processing, and star identification. More...

Files

file  sc_optics.h
 Optical functions and types.
 
file  sc_star_catalog.h
 Star catalog class definitions.
 
file  sc_star_image.h
 Star image processing functions.
 

Classes

struct  camera_data_s
 
struct  psf_data_s
 Structure for storing point spread function data. More...
 
struct  gaussian_psf_s
 Structure for implementing a Gaussian psf. More...
 
struct  airy_psf_s
 Structure for implementing an Airy psf. More...
 
struct  airydefocused_psf_s
 Structure for implementing a defocused Airy psf. More...
 
class  ImagePSF
 Helper class for matching PSFs to images. More...
 
class  star
 Star object. More...
 
class  star_catalog
 Star catalog. More...
 
struct  star_triad
 Star triad structure. More...
 
class  near_matrix
 Near matrix class. More...
 
class  star_meas
 Identifies stars from a star catalog assuming a pinhole camera model. More...
 

Typedefs

typedef struct camera_data_s camera_data_t
 
typedef struct psf_data_s psf_data_t
 Structure for storing point spread function data.
 
typedef gaussian_psf_s gaussian_psf_t
 Structure for implementing a Gaussian psf.
 
typedef airy_psf_s airy_psf_t
 Structure for implementing an Airy psf.
 
typedef airydefocused_psf_s airydefocused_psf_t
 Structure for implementing a defocused Airy psf.
 
typedef struct star_triad StarTriad
 Star triad structure. More...
 

Functions

double effective_focal_length (ml_matrix distance, ml_matrix focal_length)
 Computes effective focal length. More...
 
double diffraction_limit (double lambda, double aperture)
 Diffraction resolution limit. More...
 
ml_matrix angle_of_view (double focal_length, ml_matrix d)
 Angle of view from focal length with a 2D input. More...
 
double angle_of_view (double focal_length, double d)
 Angle of view from focal length with a 1D input. More...
 
ml_matrix angle_of_view (ml_matrix focal_length, double d)
 Angle of view from a matrix of focal lengths with a 1D input. More...
 
double focal_length_from_angle_of_view (double alpha, double d)
 Focal length from angle of view. More...
 
ml_matrix separation_angles (ml_matrix u)
 Separation angles and pairs.
 
ml_matrix pix_to_u (ml_matrix p, double f)
 Converts a pixel map to a unit vector assuming a pinhole camera model. More...
 
ml_matrix u_to_pix (const ml_matrix &r, double f, double row=0, double col=0)
 Converts a unit vector to a pixel map assuming a pinhole camera model. More...
 
double laser_beam_radius (double d, double lambda, double z)
 Laser beam radius. More...
 
double laser_power (double d, double lambda, double z, double power)
 Laser power. More...
 
camera_data_t camera_calibration (const ml_matrix &pD, const ml_matrix &pW)
 Camera calibration. More...
 
ml_matrix calibration_cube (double w, double r, int n)
 Camera cube. More...
 
ml_matrix camera_calibration_model (camera_data_t d, const ml_matrix &pW, double f)
 Camera model. More...
 
ml_matrix imager_psf (ml_matrix PSF(const ml_matrix &x, const ml_matrix &y, void *context), psf_data_t *d)
 Imager with point spread functions. More...
 
void imager_psf_uint16 (ml_matrix PSF(const ml_matrix &x, const ml_matrix &y, void *context), psf_data_t *d, uint16_t *frame)
 Imager with point spread function return a uint16_t array. More...
 
int any_less_than (const ml_matrix &x, double d)
 Find if any value of x is less than d. More...
 
ml_matrix rhs_gaussian_psf (const ml_matrix &x, const ml_matrix &y, void *context)
 Gaussian point spread function. More...
 
ml_matrix rhs_airy_psf (const ml_matrix &x, const ml_matrix &y, void *context)
 Airy point spread function. More...
 
ml_matrix rhs_airy_defocused_psf (const ml_matrix &x, const ml_matrix &y, void *context)
 Defocused Airy point spread function. More...
 
ml_matrix rand_pn (double f, int n, int m)
 Poisson random matrix. More...
 
ml_matrix fit_PSF_to_data (const ml_matrix &r0, const ml_matrix &intensity, const ml_matrix &pixels, int nUse, int mUse)
 Fit PSF to coarse centroid data using numerical optimization. More...
 
double cost_psf (const ml_matrix &x, void *context)
 PSF cost function.
 

Detailed Description

Optics, image processing, and star identification.

Structure for storing camera data.

Typedef Documentation

◆ StarTriad

typedef struct star_triad StarTriad

Star triad structure.

Stores the integer ID of the three stars in the triad.

Function Documentation

◆ effective_focal_length()

double effective_focal_length ( ml_matrix  distance,
ml_matrix  focal_length 
)

Computes effective focal length.

Computes effective focal length.

Parameters
distanceArray of distances between lenses
focal_lengthArray of lens focal lengths
Returns
Effective focal length

◆ diffraction_limit()

double diffraction_limit ( double  lambda,
double  aperture 
)

Diffraction resolution limit.

Diffraction resolution limit.

Parameters
lambdaWavelength
apertureWidth of aperture
Returns
Diffraction limited resolution

◆ angle_of_view() [1/3]

ml_matrix angle_of_view ( double  focal_length,
ml_matrix  d 
)

Angle of view from focal length with a 2D input.

Angle of view from focal length with a 2D input.

Parameters
focal_lengthFocal length
dWidth of imaging chip
Returns
Angle of view

◆ angle_of_view() [2/3]

double angle_of_view ( double  focal_length,
double  d 
)

Angle of view from focal length with a 1D input.

Angle of view from focal length with a 1D input.

The width and focal length must have the same units.

Parameters
focal_lengthFocal length
dWidth of imaging chip
Returns
Angle of view

◆ angle_of_view() [3/3]

ml_matrix angle_of_view ( ml_matrix  focal_length,
double  d 
)

Angle of view from a matrix of focal lengths with a 1D input.

Angle of view from a matrix of focal lengths with a 1D input.

Parameters
focal_lengthFocal length
dWidth of imaging chip
Returns
Angle of view

◆ focal_length_from_angle_of_view()

double focal_length_from_angle_of_view ( double  alpha,
double  d 
)

Focal length from angle of view.

Focal length from angle of view.

Parameters
alphaAngle of view
Returns
Width of imaging chip

◆ pix_to_u()

ml_matrix pix_to_u ( ml_matrix  p,
double  f 
)

Converts a pixel map to a unit vector assuming a pinhole camera model.

Converts a pixel map to a unit vector assuming a pinhole camera model.

Parameters
pPixel coordinates
fFocal length in pixel units
Returns
Unit vectors

Referenced by star_meas::Pyramid().

◆ u_to_pix()

ml_matrix u_to_pix ( const ml_matrix &  r,
double  f,
double  row,
double  col 
)

Converts a unit vector to a pixel map assuming a pinhole camera model.

Converts a unit vector to a pixel map assuming a pinhole camera model.

Includes an offset. If row and col are zero then 0,0 is the center of the imager.

Parameters
rPosition vector
fFocal length in pixels
Returns
[col;row] in pixel frames

Referenced by PinholeCamera::Update().

◆ laser_beam_radius()

double laser_beam_radius ( double  d,
double  lambda,
double  z 
)

Laser beam radius.

Laser beam radius.

Parameters
dAperture (m)
lambdaWavelength (m)
range(m)
Returns
Beam radius (m)

References PI.

Referenced by laser_power().

◆ laser_power()

double laser_power ( double  d,
double  lambda,
double  z,
double  power 
)

Laser power.

Laser power.

Parameters
dAperture (m)
lambdaWavelength (m)
range(m)
power(m)
Returns
Beam radius (m)

References laser_beam_radius().

◆ camera_calibration()

camera_data_t camera_calibration ( const ml_matrix &  pD,
const ml_matrix &  pW 
)

Camera calibration.

Parameters
dMeasured coordinates (m)
pWWorld points (m)
Returns
Camera parameters

References camera_data_s::alpha, camera_data_s::f, camera_data_s::k1, camera_data_s::k2, camera_data_s::o, orthogonalize(), pinv(), camera_data_s::R, camera_data_s::s, and camera_data_s::T.

◆ calibration_cube()

ml_matrix calibration_cube ( double  w,
double  r,
int  n 
)

Camera cube.

Camera cube.

Parameters
wWidth of square (m)
rCube width (m)
nNumber of squares
Returns
Points of square corners

◆ camera_calibration_model()

ml_matrix camera_calibration_model ( camera_data_t  d,
const ml_matrix &  pW,
double  f 
)

Camera model.

Camera model.

Parameters
dCamera data structure
pWWorld points (m)
Returns
Points in pixel frame

References camera_data_s::o, camera_data_s::R, camera_data_s::s, and camera_data_s::T.

◆ imager_psf()

ml_matrix imager_psf ( ml_matrix   PSFconst ml_matrix &x, const ml_matrix &y, void *context,
psf_data_t d 
)

Imager with point spread functions.

Imager with point spread functions.

The functions are integrated using two_dimensional_integration().

Parameters
PSFPoint spread function
dData to be passed to PSF
Returns
Imager pixel values (n,m)

References any_less_than(), psf_data_s::m, psf_data_s::n, psf_data_s::r, two_dimensional_integration(), psf_data_s::x_pixel, and psf_data_s::y_pixel.

Referenced by cost_psf().

◆ imager_psf_uint16()

void imager_psf_uint16 ( ml_matrix   PSFconst ml_matrix &x, const ml_matrix &y, void *context,
psf_data_t d,
uint16_t *  frame 
)

Imager with point spread function return a uint16_t array.

Imager with point spread function return a uint16_t array.

The functions are integrated using two_dimensional_integration().

Parameters
PSFPoint spread function
dData to be passed to PSF
frameFrame uint16_t[n*m]

References any_less_than(), psf_data_s::m, psf_data_s::n, psf_data_s::r, two_dimensional_integration(), psf_data_s::x_pixel, and psf_data_s::y_pixel.

◆ any_less_than()

int any_less_than ( const ml_matrix &  x,
double  d 
)

Find if any value of x is less than d.

Find if any value of x is less than d.

Parameters
xmatrix to be tested
dvalue to test again
Returns
1 if any value is less thand d

Referenced by imager_psf(), and imager_psf_uint16().

◆ rhs_gaussian_psf()

ml_matrix rhs_gaussian_psf ( const ml_matrix &  x,
const ml_matrix &  y,
void *  context 
)

Gaussian point spread function.

This is in a format to be integrated by two_dimensional_integration. The context pointer should be data of type gaussian_psf_t to be passed to the PSF.

Parameters
xx pixel coordinates
yy pixel coordinates
contextData including rPSF, iPSF, and sigma
Returns
psf

References psf_data_s::i, psf_data_s::r, and gaussian_psf_s::sigma.

Referenced by cost_psf().

◆ rhs_airy_psf()

ml_matrix rhs_airy_psf ( const ml_matrix &  x,
const ml_matrix &  y,
void *  context 
)

Airy point spread function.

Airy point spread function.

This function uses the Bessel function of the first kind, j1.

See also
j1, airy_psf_t
Parameters
x(n,m) X coordinates (um)
y(n,m) Y coordinates (um)
contextPSF data of type airy_psf_t
Returns
PSF output (n,m)

References airy_psf_s::aperture, airy_psf_s::f_length, psf_data_s::i, PI, psf_data_s::r, and airy_psf_s::wavelength.

◆ rhs_airy_defocused_psf()

ml_matrix rhs_airy_defocused_psf ( const ml_matrix &  x,
const ml_matrix &  y,
void *  context 
)

Defocused Airy point spread function.

Defocused Airy point spread function.

A spherical wavefront W yields an aberration-free image in the Gaussian image plane at a distance R. A defocused image is formed when observed in a plane at a distance z.

The defocused irradiance is:

I(r,z) = (2R/z)^2 | int_0^1 {exp(i B_d rho^2) J0( pi*(R/z)rho*r ) rho drho} |^2

where z is the distance to the defocused image plane and R is the distance to the Gaussian image plane. rho is r/a, 0 <= rho <= 1, and a is the (half) aperture. B_d is the peak defocus phase aberration:

B_d(z) = pi a^2/(lambda*R) * (R/z - 1)

where lambda is the wavelength.

The defocused Airy function requires numerical integration. A trapezoid method is used for speed.

Parameters
xX coordinates (n,m)
yY coordinates (n,m)
contextData required by PSF
Returns
PSF output (n,m)
See also
airydefocused_psf_s

References airy_psf_s::aperture, airydefocused_psf_s::defocus, airy_psf_s::f_length, psf_data_s::i, PI, psf_data_s::r, trapezoidal_integration(), and airy_psf_s::wavelength.

◆ rand_pn()

ml_matrix rand_pn ( double  lambda,
int  n,
int  m 
)

Poisson random matrix.

Parameters
lambdaParameter
nRows
mColumns
Returns
Poisson random matrix

Referenced by imager_model::update().

◆ fit_PSF_to_data()

ml_matrix fit_PSF_to_data ( const ml_matrix &  r0,
const ml_matrix &  intensity,
const ml_matrix &  pixels,
int  nUse,
int  mUse 
)

Fit PSF to coarse centroid data using numerical optimization.

Fit PSF to coarse centroid data using numerical optimization.

Refine the pixel fit numerically using search via downhill_simplex().

Parameters
r0Estimated centroids from COM method (2,n)
intensityMeasured intensity (1,n)
pixelsPixel data (:,:)
Returns
Updated centroid locations

References cost_psf(), downhill_simplex(), psf_data_s::i, psf_data_s::m, psf_data_s::n, ImagePSF::psf_data, psf_data_s::r, gaussian_psf_s::sigma, psf_data_s::x_pixel, and psf_data_s::y_pixel.