Commit a663435e authored by Jasem Mutlaq's avatar Jasem Mutlaq
Browse files

More work on canny star

parent 80b6a2ad
......@@ -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;
}
......
......@@ -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);
......
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