Instrument Neutral Distributed Interface INDI 2.2.5
frametracker.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2026 by Jasem Mutlaq <[email protected]>
3
4 Frame Tracker
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22#pragma once
23
24#include <cstddef>
25#include <cstdint>
26
27namespace INDI
28{
29
44{
45 public:
46 struct Image
47 {
48 const uint8_t *data {nullptr};
49 size_t width {0};
50 size_t height {0};
52 size_t components {1};
56 bool bayer {false};
57 };
58
60 {
61 bool valid {false};
63 double x {0};
64 double y {0};
66 double area {0};
68 double quality {0};
69 };
70
71 struct Report
72 {
74 bool valid {false};
76 double x {0};
77 double y {0};
79 double offsetX {0};
80 double offsetY {0};
82 double quality {0};
84 double windowStart {0};
86 uint32_t samples {0};
87 };
88
95 static Measurement measure(const Image &image, double referenceArea = 0);
96
98 void reset();
99
101 void setLock(double x, double y);
102
103 bool hasLock() const
104 {
105 return m_HasLock;
106 }
107 double lockX() const
108 {
109 return m_LockX;
110 }
111 double lockY() const
112 {
113 return m_LockY;
114 }
115 double lockArea() const
116 {
117 return m_LockArea;
118 }
119
129 bool addMeasurement(const Measurement &measurement, double time, double window, Report &report);
130
131 private:
132 void resetWindow();
133
134 bool m_HasLock {false};
135 double m_LockX {0};
136 double m_LockY {0};
137 double m_LockArea {0};
138
139 bool m_WindowOpen {false};
140 double m_WindowStart {0};
141 uint32_t m_Samples {0};
142 uint32_t m_ValidSamples {0};
143 double m_SumX {0};
144 double m_SumY {0};
145 double m_SumQuality {0};
146};
147
148}
The FrameTracker class measures where a bright extended target (planet, Moon or Sun disk) sits in a v...
bool hasLock() const
double lockArea() const
void setLock(double x, double y)
Lock to an explicit position. Restarts the averaging window.
static Measurement measure(const Image &image, double referenceArea=0)
measure Find the target in a single frame.
double lockY() const
void reset()
Drop the lock point and the current averaging window.
double lockX() const
bool addMeasurement(const Measurement &measurement, double time, double window, Report &report)
addMeasurement Add a measurement to the averaging window.
Namespace to encapsulate INDI client, drivers, and mediator classes.
bool bayer
Raw Bayer mosaic: binning is kept even so each bin averages whole CFA cells.
size_t bytesPerComponent
1 for 8-bit, 2 for 16-bit (native endian) samples
size_t components
1 for mono or Bayer, 3 for interleaved RGB
double quality
0 (unusable) to 1 (clean, well separated disk)
double area
Blob area in frame pixels.
double x
Centroid in frame pixels.
double offsetX
Averaged centroid minus lock point.
double quality
Mean quality of the valid samples, scaled by the fraction of samples that were valid.
double windowStart
Time of the first sample in the window.
bool valid
False if no sample in the window was valid (target lost).
uint32_t samples
Number of samples in the window.
double x
Averaged centroid in frame pixels.