Changeset View
Changeset View
Standalone View
Standalone View
kstars/fitsviewer/fitscentroiddetector.h
- This file was added.
1 | /*************************************************************************** | ||||
---|---|---|---|---|---|
2 | fitscentroiddetector.h - FITS Image | ||||
3 | ------------------- | ||||
4 | begin : Sat March 28 2020 | ||||
5 | copyright : (C) 2004 by Jasem Mutlaq, (C) 2020 by Eric Dejouhanet | ||||
6 | email : eric.dejouhanet@gmail.com | ||||
7 | ***************************************************************************/ | ||||
8 | | ||||
9 | /*************************************************************************** | ||||
10 | * * | ||||
11 | * This program is free software; you can redistribute it and/or modify * | ||||
12 | * it under the terms of the GNU General Public License as published by * | ||||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||||
14 | * (at your option) any later version. * | ||||
15 | * * | ||||
16 | * Some code fragments were adapted from Peter Kirchgessner's FITS plugin* | ||||
17 | * See http://members.aol.com/pkirchg for more details. * | ||||
18 | ***************************************************************************/ | ||||
19 | | ||||
20 | #ifndef FITSCENTROIDDETECTOR_H | ||||
21 | #define FITSCENTROIDDETECTOR_H | ||||
22 | | ||||
23 | #include <QObject> | ||||
24 | #include "fitsstardetector.h" | ||||
25 | | ||||
26 | class FITSCentroidDetector: public FITSStarDetector | ||||
27 | { | ||||
28 | Q_OBJECT | ||||
29 | | ||||
30 | public: | ||||
31 | explicit FITSCentroidDetector(FITSData *parent): FITSStarDetector(parent) {}; | ||||
32 | | ||||
33 | public: | ||||
34 | /** @brief Find sources in the parent FITS data file. | ||||
35 | * @see FITSStarDetector::findSources(). | ||||
36 | */ | ||||
37 | int findSources(QList<Edge*> &starCenters, QRect const &boundary = QRect()) override; | ||||
38 | | ||||
39 | /** @brief Configure the detection method. | ||||
40 | * @see FITSStarDetector::configure(). | ||||
41 | * @note Parameter "initStdDev" defaults to MINIMUM_STDVAR. | ||||
42 | * @note Parameter "minEdgeWidth" defaults to MINIMUM_PIXEL_RANGE. | ||||
43 | * @todo Provide all constants of this class as parameters, and explain their use. | ||||
44 | */ | ||||
45 | FITSStarDetector & configure(const QString &setting, const QVariant &value) override; | ||||
46 | | ||||
47 | public: | ||||
48 | /** @group Detection internals | ||||
49 | * @{ */ | ||||
50 | static constexpr int MINIMUM_STDVAR { 5 }; | ||||
51 | static constexpr int MINIMUM_PIXEL_RANGE { 5 }; | ||||
52 | static constexpr int MINIMUM_EDGE_LIMIT { 2 }; | ||||
53 | static constexpr int MAX_EDGE_LIMIT { 10000 }; | ||||
54 | static constexpr double DIFFUSE_THRESHOLD { 0.15 }; | ||||
55 | static constexpr int MINIMUM_ROWS_PER_CENTER { 3 }; | ||||
56 | static constexpr int LOW_EDGE_CUTOFF_1 { 50 }; | ||||
57 | static constexpr int LOW_EDGE_CUTOFF_2 { 10 }; | ||||
58 | /** @} */ | ||||
59 | | ||||
60 | protected: | ||||
61 | /** @internal Find sources in the parent FITS data file, dependent of the pixel depth. | ||||
62 | * @see FITSGradientDetector::findSources. | ||||
63 | */ | ||||
64 | template <typename T> | ||||
65 | int findSources(QList<Edge*> &starCenters, const QRect &boundary); | ||||
66 | | ||||
67 | /** @internal Check whether two sources overlap. | ||||
68 | * @param s1, s2 are the two sources to check collision on. | ||||
69 | * @return true if the sources collide, else false. | ||||
70 | */ | ||||
71 | bool checkCollision(Edge * s1, Edge * s2) const; | ||||
72 | | ||||
73 | protected: | ||||
74 | int m_initStdDev { MINIMUM_STDVAR }; | ||||
75 | int m_minEdgeWidth { MINIMUM_PIXEL_RANGE }; | ||||
76 | }; | ||||
77 | | ||||
78 | #endif // FITSCENTROIDDETECTOR_H |