File: demofitsstarextract.cpp

package info (click to toggle)
stellarsolver 2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,112 kB
  • sloc: ansic: 31,587; cpp: 15,103; python: 186; sh: 74; pascal: 67; perl: 9; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 1,433 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <QApplication>

//Includes for this project
#include "structuredefinitions.h"
#include "stellarsolver.h"
#include "ssolverutils/fileio.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
#if defined(__linux__)
    setlocale(LC_NUMERIC, "C");
#endif
    fileio fileLoader;
    fileLoader.logToSignal = false;
    if(!fileLoader.loadImage("randomsky.fits"))
    {
        printf("Error in loading FITS file");
        exit(1);
    }
    FITSImage::Statistic stats = fileLoader.getStats();
    uint8_t *imageBuffer = fileLoader.getImageBuffer();

    StellarSolver stellarSolver(stats, imageBuffer);
    stellarSolver.setProperty("ExtractorType", SSolver::EXTRACTOR_INTERNAL);
    stellarSolver.setProperty("ProcessType", SSolver::EXTRACT);
    stellarSolver.setParameterProfile(SSolver::Parameters::ALL_STARS);

    if(!stellarSolver.extract(false))
    {
        printf("Solver Failed");
        exit(0);
    }
    QList<FITSImage::Star> starList = stellarSolver.getStarList();
    printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
    printf("Stars found: %u\n", starList.count());
    for(int i=0; i < starList.count(); i++)
    {
        FITSImage::Star star = starList.at(i);
        printf("Star #%u: (%f x, %f y), (%f a, %f b, %f theta), mag: %f, flux: %f, peak: %f \n ", i, star.x, star.y, star.a, star.b, star.theta, star.mag, star.flux, star.peak);
    }

    return 0;
}