Changeset View
Changeset View
Standalone View
Standalone View
kstars/fitsviewer/fitsbahtinovdetector.h
- This file was added.
1 | /*************************************************************************** | ||||
---|---|---|---|---|---|
2 | fitsbahtinovdetector.h - FITS Image | ||||
3 | ------------------- | ||||
4 | begin : Wed April 15 2020 | ||||
5 | copyright : (C) 2020 by Patrick Molenaar | ||||
6 | email : pr_molenaar@hotmail.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 | ***************************************************************************/ | ||||
17 | | ||||
18 | #ifndef FITSBAHTINOVDETECTOR_H | ||||
19 | #define FITSBAHTINOVDETECTOR_H | ||||
20 | | ||||
21 | #include "fitsstardetector.h" | ||||
22 | | ||||
23 | class BahtinovLineAverage | ||||
24 | { | ||||
25 | public: | ||||
26 | BahtinovLineAverage() | ||||
27 | { | ||||
28 | average = 0.0; | ||||
29 | offset = 0; | ||||
30 | } | ||||
31 | virtual ~BahtinovLineAverage() = default; | ||||
32 | | ||||
33 | double average; | ||||
34 | size_t offset; | ||||
35 | }; | ||||
36 | | ||||
37 | class FITSBahtinovDetector: public FITSStarDetector | ||||
38 | { | ||||
39 | Q_OBJECT | ||||
40 | | ||||
41 | public: | ||||
42 | explicit FITSBahtinovDetector(FITSData *parent): FITSStarDetector(parent) {}; | ||||
43 | | ||||
44 | public: | ||||
45 | /** @brief Find sources in the parent FITS data file. | ||||
46 | * @see FITSStarDetector::findSources(). | ||||
47 | */ | ||||
48 | int findSources(QList<Edge*> &starCenters, QRect const &boundary = QRect()) override; | ||||
49 | | ||||
50 | /** @brief Configure the detection method. | ||||
51 | * @see FITSStarDetector::configure(). | ||||
52 | * @note Parameter "numaveragerows" defaults to NUMBER_OF_AVERAGE_ROWS of the mean pixel value of the frame. | ||||
53 | * @todo Provide parameters for detection configuration. | ||||
54 | */ | ||||
55 | FITSStarDetector & configure(const QString &setting, const QVariant &value) override; | ||||
56 | | ||||
57 | public: | ||||
58 | /** @group Detection parameters. | ||||
59 | * @{ */ | ||||
60 | int NUMBER_OF_AVERAGE_ROWS { 1 }; | ||||
61 | /** @} */ | ||||
62 | | ||||
63 | protected: | ||||
64 | /** @internal Find sources in the parent FITS data file, dependent of the pixel depth. | ||||
65 | * @see FITSGradientDetector::findSources. | ||||
66 | */ | ||||
67 | template <typename T> | ||||
68 | int findBahtinovStar(QList<Edge*> &starCenters, const QRect &boundary); | ||||
69 | | ||||
70 | private: | ||||
71 | template <typename T> | ||||
72 | BahtinovLineAverage calculateMaxAverage(const FITSData *data, int angle); | ||||
73 | template <typename T> | ||||
74 | bool rotateImage(const FITSData *data, int angle, T * rotimage); | ||||
75 | }; | ||||
76 | | ||||
77 | #endif // FITSBAHTINOVDETECTOR_H |