summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-17 10:49:22 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-17 10:49:22 (GMT)
commita663435ecf8c6fd22ca0d2af801a5fe8777f0ef5 (patch)
treedd4cf522bb4d49530651793692115cd6566ef6a8
parent80b6a2ad16f3c1067a10a3014d77520d841842da (diff)
More work on canny star
-rw-r--r--kstars/fitsviewer/fitsdata.cpp25
-rw-r--r--kstars/fitsviewer/fitsdata.h1
2 files changed, 18 insertions, 8 deletions
diff --git a/kstars/fitsviewer/fitsdata.cpp b/kstars/fitsviewer/fitsdata.cpp
index 45d261a..c66e788 100644
--- a/kstars/fitsviewer/fitsdata.cpp
+++ b/kstars/fitsviewer/fitsdata.cpp
@@ -622,11 +622,12 @@ Edge* FITSData::findCannyStar(FITSData *data, const QRect &boundary)
// Maximum Radius
int maxR = qMin(subW-1, subH-1) / 2;
+
for (int r=maxR; r > 1; r--)
{
int pass=0;
- for (float theta=0; theta < 2*M_PI; theta += (2*M_PI)/10.0)
+ for (float theta=0; theta < 2*M_PI; theta += (2*M_PI)/36.0)
{
int testX = center->x + cos(theta) * r;
int testY = center->y + sin(theta) * r;
@@ -636,13 +637,15 @@ Edge* FITSData::findCannyStar(FITSData *data, const QRect &boundary)
break;
if (gradients[testX + testY * subW] > 0)
- pass++;
- }
-
- if (pass >= 5)
- {
- center->width = r*2;
- break;
+ {
+ if (++pass >= 24)
+ {
+ center->width = r*2;
+ // Break of outer loop
+ r=0;
+ break;
+ }
+ }
}
}
@@ -667,6 +670,11 @@ Edge* FITSData::findCannyStar(FITSData *data, const QRect &boundary)
const float *origBuffer = data->getImageBuffer() + offset;
+ QDebug deb = qDebug();
+
+ for (int i=0; i < subW; i++)
+ deb << origBuffer[i + cen_y * subW] << ",";
+
for (double x=leftEdge; x <= rightEdge; x += resolution)
{
//subPixels[x] = resolution * (image_buffer[static_cast<int>(floor(x)) + cen_y * stats.width] - min);
@@ -701,6 +709,7 @@ Edge* FITSData::findCannyStar(FITSData *data, const QRect &boundary)
lastTF = TF;
}
+ data->appendStar(center);
return center;
}
diff --git a/kstars/fitsviewer/fitsdata.h b/kstars/fitsviewer/fitsdata.h
index 046c522..5835ccb 100644
--- a/kstars/fitsviewer/fitsdata.h
+++ b/kstars/fitsviewer/fitsdata.h
@@ -125,6 +125,7 @@ public:
// Star detection
int getDetectedStars() { return starCenters.count(); }
bool areStarsSearched() { return starsSearched; }
+ void appendStar(Edge* newCenter) { starCenters.append(newCenter); }
QList<Edge*> getStarCenters() { return starCenters;}
int findStars(const QRectF &boundary = QRectF(), bool force=false);
void findCentroid(const QRectF &boundary = QRectF(), int initStdDev=MINIMUM_STDVAR, int minEdgeWidth=MINIMUM_PIXEL_RANGE);