summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-21 20:50:23 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-21 20:50:23 (GMT)
commit69c6da9c170872da03adb83a40bb3936215ae519 (patch)
tree87f6a031ec2f036ba7d0998f694423e641cc7081
parentdc272db82feb13543a38ed7a3edf6fadcf2d2ab0 (diff)
Set binning in cmath to calculate final frame w and h
-rw-r--r--kstars/ekos/guide/internalguide/gmath.cpp16
-rw-r--r--kstars/ekos/guide/internalguide/gmath.h6
-rw-r--r--kstars/ekos/guide/internalguide/internalguider.cpp2
3 files changed, 13 insertions, 11 deletions
diff --git a/kstars/ekos/guide/internalguide/gmath.cpp b/kstars/ekos/guide/internalguide/gmath.cpp
index 5f9d727..19eec4f 100644
--- a/kstars/ekos/guide/internalguide/gmath.cpp
+++ b/kstars/ekos/guide/internalguide/gmath.cpp
@@ -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;
diff --git a/kstars/ekos/guide/internalguide/gmath.h b/kstars/ekos/guide/internalguide/gmath.h
index 7fb09d4..266a3f2 100644
--- a/kstars/ekos/guide/internalguide/gmath.h
+++ b/kstars/ekos/guide/internalguide/gmath.h
@@ -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
diff --git a/kstars/ekos/guide/internalguide/internalguider.cpp b/kstars/ekos/guide/internalguide/internalguider.cpp
index 15ac20e..0f1ceb3 100644
--- a/kstars/ekos/guide/internalguide/internalguider.cpp
+++ b/kstars/ekos/guide/internalguide/internalguider.cpp
@@ -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;
}