Spacecraft Control Framework 1.0
Spacecraft Control Library
sc_star_image.h
Go to the documentation of this file.
1//
5//
6// SCControl/Optics
7//
8// Created by Stephanie Thomas on 7/26/17.
9//
10
11#ifndef sc_star_image_hpp
12#define sc_star_image_hpp
13
14#ifdef AS_OS_WINDOWS
15#include "matrixlib.h"
16#else
17#include <MatrixLib/MatrixLib.h>
18#endif
19#include <list>
20#include <stdint.h>
21#include <time.h>
22using namespace std;
23
24#include <stdio.h>
25
27typedef struct gaussian_fit_s {
28 bool status;
29 double center;
30 double std_dev;
31 double height;
32 int iter;
34
36typedef struct gaussian_xyfit_s {
37 bool status[2];
38 double center[2];
39 double std_dev[2];
40 double height[2];
41 int iter[2];
43
45ml_matrix vm_to_intensity( ml_matrix v );
47ml_matrix intensity_to_vm( ml_matrix i );
49double vm_to_intensity( double v );
51double intensity_to_vm( double i );
53void index_to_sub(int r, int c, int k , int* kR, int* kC );
55ml_matrix centroid_COM( const ml_matrix& p, double threshold, int n );
57ml_matrix coarse_centroid_COM( const ml_matrix& p, double threshold=0.0, int n=5 );
59int edge_correction( int k0, int kC, int m );
61ml_matrix zodiacal_light( const ml_matrix& r, const ml_matrix& beta );
63double zodiacal_light( double r );
65void apply_threshold(ml_matrix& x, double b=-1.0, double T=0.0);
67ml_matrix fit_gaussian(const ml_matrix& pixels, const ml_matrix& r0, gaussian_xyfit_t& data);
68
70struct star_blob {
71 // bounding box
72 double r0;
73 double r1;
74 double c0;
75 double c1;
76 // location of nonzero elements
77 ml_matrix iPixels;
78 int nPix;
79 // maximum pixel in blob
80 double pMax;
81 // total counts in star
82 double counts;
83 ml_matrix iMax;
84 double radius;
85};
86
88std::list<star_blob> Blobify(const ml_matrix& pixels, int minPix=4);
89
90#endif /* sc_star_image_h */
std::list< star_blob > Blobify(const ml_matrix &pixels, int minPix=4)
Blobify a pixelmap.
Definition: sc_star_image.cc:712
ml_matrix centroid_COM(const ml_matrix &p, double threshold, int n)
Find centroids in a pixelmap using the center of mass method.
Definition: sc_star_image.cc:84
int edge_correction(int k0, int kC, int m)
Edge correction.
Definition: sc_star_image.cc:317
ml_matrix intensity_to_vm(ml_matrix i)
Converts intensity to visual magnitude.
Definition: sc_star_image.cc:40
void apply_threshold(ml_matrix &x, double b=-1.0, double T=0.0)
Star image noise processing function.
Definition: sc_star_image.cc:411
ml_matrix fit_gaussian(const ml_matrix &pixels, const ml_matrix &r0, gaussian_xyfit_t &data)
Fit symmetric Gaussians to a star image.
Definition: sc_star_image.cc:533
struct gaussian_xyfit_s gaussian_xyfit_t
Structure for X/Y Gaussian fit.
void index_to_sub(int r, int c, int k, int *kR, int *kC)
Matrix index to subscripts.
Definition: sc_star_image.cc:69
ml_matrix vm_to_intensity(ml_matrix v)
Converts visual magnitude to intensity.
Definition: sc_star_image.cc:18
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.
Definition: sc_star_image.cc:256
struct gaussian_fit_s gaussian_fit_t
Structure for Gaussian fit.
ml_matrix zodiacal_light(const ml_matrix &r, const ml_matrix &beta)
Zodiacal light.
Definition: sc_star_image.cc:353
Structure for Gaussian fit.
Definition: sc_star_image.h:27
double std_dev
Center
Definition: sc_star_image.h:30
bool status
Status flag.
Definition: sc_star_image.h:28
double height
Height at center.
Definition: sc_star_image.h:31
int iter
Iterations.
Definition: sc_star_image.h:32
Structure for X/Y Gaussian fit.
Definition: sc_star_image.h:36
double std_dev[2]
Center
Definition: sc_star_image.h:39
double height[2]
Height at center.
Definition: sc_star_image.h:40
int iter[2]
Iterations.
Definition: sc_star_image.h:41
bool status[2]
Status flag.
Definition: sc_star_image.h:37
Blob in a star image.
Definition: sc_star_image.h:70