Commit 69c6da9c authored by Jasem Mutlaq's avatar Jasem Mutlaq
Browse files

Set binning in cmath to calculate final frame w and h

parent dc272db8
......@@ -67,7 +67,7 @@ cgmath::cgmath() : QObject()
useRapidGuide = false;
dec_swap = false;
subBinX = subBinY = lastBinX = lastBinY = 1;
subBinX = subBinY = 1;
// square variables
square_alg_idx = SMART_THRESHOLD;
......@@ -109,13 +109,16 @@ cgmath::~cgmath()
}
bool cgmath::setVideoParameters( int vid_wd, int vid_ht )
bool cgmath::setVideoParameters(int vid_wd, int vid_ht , int binX, int binY)
{
if( vid_wd <= 0 || vid_ht <= 0 )
return false;
video_width = vid_wd;
video_height = vid_ht;
video_width = vid_wd/binX;
video_height = vid_ht/binY;
subBinX = binX;
subBinY = binY;
//set_reticle_params( video_width/2, video_height/2, -1 ); // keep orientation
......@@ -565,8 +568,7 @@ Vector cgmath::findLocalStarPosition( void ) const
double square_square = trackingBox.width()*trackingBox.width();
//psrc = porigin = pdata + trackingBox.y()*video_width + trackingBox.x();
psrc = porigin = pdata + trackingBox.y()*video_width + trackingBox.x();
psrc = porigin = pdata + trackingBox.y()* video_width + trackingBox.x();
resx = resy = 0;
threshold = mass = 0;
......@@ -920,7 +922,7 @@ void cgmath::performProcessing( void )
// find guiding star location in
scr_star_pos = star_pos = findLocalStarPosition();
if (star_pos.x == -1 || star_pos.y == -1)
if (star_pos.x == -1 || std::isnan(star_pos.x))
{
lost_star = true;
return;
......
......@@ -111,7 +111,7 @@ public:
virtual ~cgmath();
// functions
bool setVideoParameters( int vid_wd, int vid_ht );
bool setVideoParameters( int vid_wd, int vid_ht, int binX, int binY );
bool setGuiderParameters( double ccd_pix_wd, double ccd_pix_ht, double guider_aperture, double guider_focal );
void getGuiderParameters( double *ccd_pix_wd, double *ccd_pix_ht, double *guider_aperture, double *guider_focal );
bool setReticleParameters( double x, double y, double ang );
......@@ -152,7 +152,7 @@ public:
void getStarScreenPosition( double *dx, double *dy ) const;
Vector findLocalStarPosition( void ) const;
bool isStarLost(void) const;
void setLostStar(bool is_lost);
void setLostStar(bool is_lost);
// Main processing function
void performProcessing( void );
......@@ -184,7 +184,7 @@ private:
// square variables
int squareSize; // size of analysing square
int square_alg_idx; // index of threshold algorithm
int subBinX,subBinY, lastBinX, lastBinY;
int subBinX,subBinY;
// sky coord. system vars.
Vector star_pos; // position of star in reticle coord. system
......
......@@ -725,7 +725,7 @@ bool InternalGuider::setFrameParams(uint16_t x, uint16_t y, uint16_t w, uint16_t
subBinX = binX;
subBinY = binY;
pmath->setVideoParameters(w, h);
pmath->setVideoParameters(w, h, subBinX, subBinY);
return true;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment