1 /* 2 SPDX-FileCopyrightText: 2020 Patrick Molenaar <pr_molenaar@hotmail.com> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #ifndef FITSBAHTINOVDETECTOR_H 8 #define FITSBAHTINOVDETECTOR_H 9 10 #include "fitsstardetector.h" 11 12 class BahtinovLineAverage 13 { 14 public: BahtinovLineAverage()15 BahtinovLineAverage() 16 { 17 average = 0.0; 18 offset = 0; 19 } 20 virtual ~BahtinovLineAverage() = default; 21 22 double average; 23 size_t offset; 24 }; 25 26 class FITSBahtinovDetector: public FITSStarDetector 27 { 28 Q_OBJECT 29 30 public: FITSBahtinovDetector(FITSData * parent)31 explicit FITSBahtinovDetector(FITSData *parent): FITSStarDetector(parent) {}; 32 33 public: 34 /** @brief Find sources in the parent FITS data file. 35 * @see FITSStarDetector::findSources(). 36 */ 37 QFuture<bool> findSources(QRect const &boundary = QRect()) override; 38 39 /** @brief Configure the detection method. 40 * @see FITSStarDetector::configure(). 41 * @note Parameter "numaveragerows" defaults to NUMBER_OF_AVERAGE_ROWS of the mean pixel value of the frame. 42 * @todo Provide parameters for detection configuration. 43 */ 44 //void configure(const QString &setting, const QVariant &value) override; 45 46 public: 47 /** @group Detection parameters. 48 * @{ */ 49 //int NUMBER_OF_AVERAGE_ROWS { 1 }; 50 /** @} */ 51 52 protected: 53 /** @internal Find sources in the parent FITS data file, dependent of the pixel depth. 54 * @see FITSGradientDetector::findSources. 55 */ 56 template <typename T> 57 bool findBahtinovStar(const QRect &boundary); 58 59 private: 60 template <typename T> 61 BahtinovLineAverage calculateMaxAverage(const FITSData *data, int angle); 62 template <typename T> 63 bool rotateImage(const FITSData *data, int angle, T * rotimage); 64 }; 65 66 #endif // FITSBAHTINOVDETECTOR_H 67