summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-08-15 09:27:53 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-08-15 09:27:53 (GMT)
commita7f0496c553ed37a670c8acfe24ff6f06ee1c07d (patch)
treed5b6a78ef505512d0209c15fd72151989c72cd88
parentd3e3d019210bada99df0804aa812a4c2af9a33cb (diff)
Add HFR calculation to weighted detection function. Need to test it under real conditions. Need to run median filter perhaps followed by high contrast filter to obtain better results
-rw-r--r--kstars/fitsviewer/fitsdata.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/kstars/fitsviewer/fitsdata.cpp b/kstars/fitsviewer/fitsdata.cpp
index d92531c..39cecec 100644
--- a/kstars/fitsviewer/fitsdata.cpp
+++ b/kstars/fitsviewer/fitsdata.cpp
@@ -630,6 +630,39 @@ int FITSData::findOneStar(const QRectF &boundary)
starCenters.append(center);
+ double FSum=0, HF=0, TF=0, min = stats.min[0];
+
+ int cen_x = center->x;
+ int cen_y = center->y;
+
+ // Complete sum along the radius
+ //for (int k=0; k < rCenter->width; k++)
+ for (int k=center->width/2; k >= -(center->width/2) ; k--)
+ {
+ FSum += image_buffer[cen_x-k+(cen_y*stats.width)] - min;
+ //qDebug() << image_buffer[cen_x-k+(cen_y*stats.width)] - min;
+ }
+
+ // Half flux
+ HF = FSum / 2.0;
+
+ // Total flux starting from center
+ TF = image_buffer[cen_y * stats.width + cen_x] - min;
+
+ int pixelCounter = 1;
+
+ // Integrate flux along radius axis until we reach half flux
+ for (int k=1; k < center->width/2; k++)
+ {
+ TF += image_buffer[cen_y * stats.width + cen_x + k] - min;
+ TF += image_buffer[cen_y * stats.width + cen_x - k] - min;
+
+ pixelCounter++;
+ }
+
+ // Calculate weighted Half Flux Radius
+ center->HFR = pixelCounter * (HF / TF);
+
return starCenters.size();
}