summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-22 20:19:05 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-22 20:19:05 (GMT)
commit8d5cca1e553a7e101b1aef517e8d4506d43d72b2 (patch)
treec384ad459d88a63567fca55941a2b69a30bc62e7
parente5abf7c1e2e527a98be197d310dba199d6a0abc5 (diff)
Gradient algorithm should only be run on subframes as running on full frame images would make it impossible to run
-rw-r--r--kstars/ekos/focus/focus.cpp48
1 files changed, 29 insertions, 19 deletions
diff --git a/kstars/ekos/focus/focus.cpp b/kstars/ekos/focus/focus.cpp
index 3702b94..98f5c73 100644
--- a/kstars/ekos/focus/focus.cpp
+++ b/kstars/ekos/focus/focus.cpp
@@ -273,8 +273,8 @@ void Focus::resetFrame()
frameSettings[targetChip] = settings;
//targetChip->setFocusFrame(0,0,0,0);
- //starSelected = false;
- starCenter = QVector3D();
+ starSelected = false;
+ starCenter = QVector3D();
subFramed = false;
focusView->setTrackingBox(QRect());
@@ -1023,13 +1023,22 @@ void Focus::setCaptureComplete()
{
if (image_data->areStarsSearched() == false)
{
- if (starSelected == false && autoStarCheck->isChecked() && subFramed == false)
- focusView->findStars(ALGORITHM_CENTROID);
- else if (focusView->isTrackingBoxEnabled())
- focusView->findStars(focusAlgorithm);
+ //if (starSelected == false && autoStarCheck->isChecked() && subFramed == false)
+ //if (autoStarCheck->isChecked() && subFramed == false)
+ //focusView->findStars(ALGORITHM_CENTROID);
- focusView->updateFrame();
- currentHFR= image_data->getHFR(HFR_MAX);
+ if (subFramed && focusView->isTrackingBoxEnabled())
+ {
+ focusView->findStars(focusAlgorithm);
+ focusView->updateFrame();
+ currentHFR= image_data->getHFR(HFR_MAX);
+ }
+ else if (autoStarCheck->isChecked())
+ {
+ focusView->findStars(ALGORITHM_CENTROID);
+ focusView->updateFrame();
+ currentHFR= image_data->getHFR(HFR_MAX);
+ }
}
if (Options::focusLogging())
@@ -1065,7 +1074,7 @@ void Focus::setCaptureComplete()
{
// Center tracking box around selected star
//if (starSelected && inAutoFocus)
- if (starCenter.isNull() == false && inAutoFocus)
+ if (starCenter.isNull() == false && (inAutoFocus || minimumRequiredHFR >= 0))
{
Edge *maxStarHFR = image_data->getMaxHFRStar();
@@ -1142,11 +1151,11 @@ void Focus::setCaptureComplete()
if (subFramed == false && kcfg_subFrame->isEnabled() && kcfg_subFrame->isChecked())
{
- int offset = focusBoxSize->value();
- int subX=(maxStar->x - offset*1.5) * subBinX;
- int subY=(maxStar->y - offset*1.5) * subBinY;
- int subW=offset*3*subBinX;
- int subH=offset*3*subBinY;
+ int offset = (static_cast<double>(focusBoxSize->value()) / subBinX) * 1.5;
+ int subX=(maxStar->x - offset) * subBinX;
+ int subY=(maxStar->y - offset) * subBinY;
+ int subW=offset*2*subBinX;
+ int subH=offset*2*subBinY;
int minX, maxX, minY, maxY, minW, maxW, minH, maxH;
targetChip->getFrameMinMax(&minX, &maxX, &minY, &maxY, &minW, &maxW, &minH, &maxH);
@@ -2075,7 +2084,7 @@ void Focus::focusStarSelected(int x, int y)
return;
}
- int offset = focusBoxSize->value()/subBinX;
+ int offset = (static_cast<double>(focusBoxSize->value())/subBinX) * 1.5;
QRect starRect;
@@ -2088,10 +2097,10 @@ void Focus::focusStarSelected(int x, int y)
targetChip->getFrameMinMax(&minX, &maxX, &minY, &maxY, &minW, &maxW, &minH, &maxH);
//targetChip->getFrame(&fx, &fy, &fw, &fy);
- x = (x - offset*1.5) * subBinX;
- y = (y - offset*1.5) * subBinY;
- int w=offset*3*subBinX;
- int h=offset*3*subBinY;
+ x = (x - offset) * subBinX;
+ y = (y - offset) * subBinY;
+ int w=offset*2*subBinX;
+ int h=offset*2*subBinY;
if (x<minX)
x=minX;
@@ -2139,6 +2148,7 @@ void Focus::focusStarSelected(int x, int y)
squareMovedOutside = (dist > (focusBoxSize->value()/subBinX));
starCenter.setX(x);
starCenter.setY(y);
+ //starRect = QRect( starCenter.x()-focusBoxSize->value()/(2*subBinX), starCenter.y()-focusBoxSize->value()/(2*subBinY), focusBoxSize->value()/subBinX, focusBoxSize->value()/subBinY);
starRect = QRect( starCenter.x()-focusBoxSize->value()/(2*subBinX), starCenter.y()-focusBoxSize->value()/(2*subBinY), focusBoxSize->value()/subBinX, focusBoxSize->value()/subBinY);
focusView->setTrackingBox(starRect);