Spacecraft Control Framework 1.0
Spacecraft Control Library
Classes | Typedefs | Functions
sc_star_image.h File Reference

Star image processing functions. More...

Go to the source code of this file.

Classes

struct  gaussian_fit_s
 Structure for Gaussian fit. More...
 
struct  gaussian_xyfit_s
 Structure for X/Y Gaussian fit. More...
 
struct  star_blob
 Blob in a star image. More...
 

Typedefs

typedef struct gaussian_fit_s gaussian_fit_t
 Structure for Gaussian fit.
 
typedef struct gaussian_xyfit_s gaussian_xyfit_t
 Structure for X/Y Gaussian fit.
 

Functions

ml_matrix vm_to_intensity (ml_matrix v)
 Converts visual magnitude to intensity. More...
 
ml_matrix intensity_to_vm (ml_matrix i)
 Converts intensity to visual magnitude. More...
 
double vm_to_intensity (double v)
 Converts visual magnitude to intensity. More...
 
double intensity_to_vm (double i)
 Converts intensity to visual magnitude. More...
 
void index_to_sub (int r, int c, int k, int *kR, int *kC)
 Matrix index to subscripts.
 
ml_matrix centroid_COM (const ml_matrix &p, double threshold, int n)
 Find centroids in a pixelmap using the center of mass method. More...
 
ml_matrix coarse_centroid_COM (const ml_matrix &p, double threshold=0.0, int n=5)
 Find centroids in a pixelmap using blobify & center of mass method. More...
 
int edge_correction (int k0, int kC, int m)
 Edge correction. More...
 
ml_matrix zodiacal_light (const ml_matrix &r, const ml_matrix &beta)
 Zodiacal light. More...
 
double zodiacal_light (double r)
 Zodiacal light. More...
 
void apply_threshold (ml_matrix &x, double b=-1.0, double T=0.0)
 Star image noise processing function. More...
 
ml_matrix fit_gaussian (const ml_matrix &pixels, const ml_matrix &r0, gaussian_xyfit_t &data)
 Fit symmetric Gaussians to a star image. More...
 
std::list< star_blobBlobify (const ml_matrix &pixels, int minPix=4)
 Blobify a pixelmap. More...
 

Detailed Description

Star image processing functions.

Function Documentation

◆ vm_to_intensity() [1/2]

ml_matrix vm_to_intensity ( ml_matrix  v)

Converts visual magnitude to intensity.

Converts visual magnitude to intensity.

Parameters
vVisual magnitude
Returns
Intensity

Referenced by star_meas::SetStarData(), and zodiacal_light().

◆ intensity_to_vm() [1/2]

ml_matrix intensity_to_vm ( ml_matrix  i)

Converts intensity to visual magnitude.

Converts intensity to visual magnitude.

Parameters
iIntensity
Returns
Visual magnitude

◆ vm_to_intensity() [2/2]

double vm_to_intensity ( double  v)

Converts visual magnitude to intensity.

Converts visual magnitude to intensity.

Parameters
vVisual magnitude
Returns
Intensity

◆ intensity_to_vm() [2/2]

double intensity_to_vm ( double  i)

Converts intensity to visual magnitude.

Converts intensity to visual magnitude.

Parameters
iIntensity
Returns
Visual magnitude

◆ centroid_COM()

ml_matrix centroid_COM ( const ml_matrix &  p,
double  threshold,
int  n 
)

Find centroids in a pixelmap using the center of mass method.

Find centroids in a pixelmap using the center of mass method.

Parameters
ppixel values (:,:)
thresholdthreshold for including in the center of mass
nsize of the region of interest
Returns
locations of centroids in pixels (2,n)

References edge_correction(), and index_to_sub().

◆ coarse_centroid_COM()

ml_matrix coarse_centroid_COM ( const ml_matrix &  p,
double  threshold,
int  n 
)

Find centroids in a pixelmap using blobify & center of mass method.

Find centroids in a pixelmap using blobify & center of mass method.

The pixelmap is first thresholded to remove pixels below the background noise. The remaining pixels are then grouped in "blobs". Centroids are computed for the blobs using a center of mass method.

TODO parameter for minimum number of pixels in blobs TODO parameter or better way for calculating noise floor b

Parameters
ppixel values (:,:)
thresholdthreshold for including in the center of mass
nsize of the region of interest
Returns
locations of centroids in pixels (2,n)
See also
apply_threshold(), Blobify()

References apply_threshold(), and Blobify().

◆ edge_correction()

int edge_correction ( int  k0,
int  kC,
int  m 
)

Edge correction.

Edge correction.

Parameters
k0
kC
m
Returns

Referenced by centroid_COM().

◆ zodiacal_light() [1/2]

ml_matrix zodiacal_light ( const ml_matrix &  r,
const ml_matrix &  beta 
)

Zodiacal light.

Used by imager functions. This is background noise.

Reference: R. Meissner, "Brightness Measurements of Stars and the Night-Sky with a Silicon-Photomultiplier-Telescope" Physikalischen Institut A, 9/2012.

Parameters
rDistance from the sun (AU)
betaEcliptic latitude (rad)
Returns
Intensity (W/m^2/rad^2)

References PI, and vm_to_intensity().

Referenced by imager_model::update().

◆ zodiacal_light() [2/2]

double zodiacal_light ( double  r)

Zodiacal light.

Zodiacal light.

Uses the worst-case beta.

Reference: R. Meissner, "Brightness Measurements of Stars and the Night-Sky with a Silicon-Photomultiplier-Telescope" Physikalischen Institut A, 9/2012.

Parameters
rDistance from the sun (AU)
Returns
Intensity (W/m^2/rad^2)

References PI, and vm_to_intensity().

◆ apply_threshold()

void apply_threshold ( ml_matrix &  x,
double  b,
double  T 
)

Star image noise processing function.

Star image noise processing function.

Values in x below the threshold, T, will be set to zero. The sky background noise, b, will be subtracted from the remaining pixels.

p(p<T) = 0 p = p - b;

If b is less than zero, the mean will be calculated. If T is less than or equal to zero, it will be approximated as b + 2.5*sigma.

Parameters
xPixelmap
bSky background noise value, to be subtracted from pixels
TThreshold value

Referenced by coarse_centroid_COM().

◆ fit_gaussian()

ml_matrix fit_gaussian ( const ml_matrix &  pixels,
const ml_matrix &  r0,
gaussian_xyfit_t data 
)

Fit symmetric Gaussians to a star image.

Fit symmetric Gaussians to a star image.

This should be a subarray containing a single star.

Parameters
pixelsPixelmap
r0Initial guess
dataAlgorithm data results
Returns
Matrix with [x;y] center

References gaussian_fit_s::height, gaussian_xyfit_s::height, gaussian_fit_s::iter, gaussian_xyfit_s::iter, gaussian_fit_s::status, gaussian_xyfit_s::status, gaussian_fit_s::std_dev, and gaussian_xyfit_s::std_dev.

◆ Blobify()

std::list< star_blob > Blobify ( const ml_matrix &  pixels,
int  minPix 
)

Blobify a pixelmap.

Blobify a pixelmap.

A bounding box is stored along with the indices of the pixels in the blob. The pixelmap is assumed to be thresholded so that most of the pixels are zero and only those nonzero pixels will be grouped into blobs. Currently only single-pixel stars are removed. The blobs are sorted in descending order by total counts.

TODO: set a cap on number or percentage of nonzero pixels.

Parameters
pixels
Returns
List of blobs

Referenced by coarse_centroid_COM().