Thermal Camera SDK 10.0.1
SDK for Optris Thermal Cameras
Loading...
Searching...
No Matches
Frame.h
Go to the documentation of this file.
1// Copyright (c) 2025 Optris GmbH Co. KG
2
10
11#pragma once
12
13#include <vector>
14
15#include "otcsdk/Api.h"
16#include "otcsdk/Exceptions.h"
18
19
20namespace optris
21{
22
32class Frame
33{
34 // Special iterator access.
35 friend class ConstFrameIterator;
36
37
38public:
40 OTC_SDK_API Frame() noexcept;
41
43 OTC_SDK_API Frame(const Frame&) = default;
45 OTC_SDK_API Frame& operator=(const Frame&) = default;
46
48 OTC_SDK_API Frame(Frame&&) = default;
50 OTC_SDK_API Frame& operator=(Frame&&) = default;
51
53 OTC_SDK_API virtual ~Frame() noexcept = default;
54
55
65 OTC_SDK_API unsigned short getValue(int index) const noexcept(false);
66
77 OTC_SDK_API unsigned short getValue(int x, int y) const noexcept(false);
78
79
87 OTC_SDK_API ConstFrameIterator getConstIterator() const noexcept;
88
89
95 OTC_SDK_API int getWidth() const noexcept;
96
102 OTC_SDK_API int getHeight() const noexcept;
103
109 OTC_SDK_API int getSize() const noexcept;
110
116 OTC_SDK_API bool isEmpty() const noexcept;
117
118
121
128 OTC_SDK_API void resize(int width, int height);
129
130
136 OTC_SDK_API Frame clone() const noexcept;
137
143 OTC_SDK_API void setData(const unsigned short* source);
144
150 OTC_SDK_API void setFromRawData(const void* source);
151
160 OTC_SDK_API void copyDataTo(unsigned short* destination, int size) const noexcept;
161
167 OTC_SDK_API const unsigned short* getData() const noexcept;
168
169
170protected:
172 std::vector<unsigned short> _values;
173
174
175private:
177 int _width;
179 int _height;
180};
181
182
183// Inline implementation
184inline ConstFrameIterator Frame::getConstIterator() const noexcept
185{
186 return ConstFrameIterator{*this};
187}
188
189inline int Frame::getWidth() const noexcept
190{
191 return _width;
192}
193
194inline int Frame::getHeight() const noexcept
195{
196 return _height;
197}
198
199inline int Frame::getSize() const noexcept
200{
201 return static_cast<int>(_values.size());
202}
203
204inline bool Frame::isEmpty() const noexcept
205{
206 return _values.empty();
207}
208
209inline Frame Frame::clone() const noexcept
210{
211 return Frame{*this};
212}
213
214inline const unsigned short* Frame::getData() const noexcept
215{
216 return _values.data();
217}
218
219} // namespace optris
Contains defines controlling the Windows DLL export and import of symbols.
#define OTC_SDK_API
Only needed when working with Windows DLLs.
Definition Api.h:65
Contains the exceptions raised by the SDK.
Contains a class that realizes the iteration over Frames.
std::vector< unsigned short > _values
Frame data.
Definition Frame.h:172
OTC_SDK_API const unsigned short * getData() const noexcept
Returns a pointer to the first element of the internal value array.
Definition Frame.h:214
OTC_SDK_API unsigned short getValue(int index) const noexcept(false)
Returns the frame data value at the given index.
OTC_SDK_API ConstFrameIterator getConstIterator() const noexcept
Returns an iterator with read access.
Definition Frame.h:184
OTC_SDK_API void setData(const unsigned short *source)
Sets the frame data values.
OTC_SDK_API void resize(int width, int height)
Resizes the frame.
OTC_SDK_API bool isEmpty() const noexcept
Returns whether the frame is empty.
Definition Frame.h:204
OTC_SDK_API void copyDataTo(unsigned short *destination, int size) const noexcept
Copies the internal values to the destination array.
OTC_SDK_API int getSize() const noexcept
Returns the overall size in pixels of the frame (width * height).
Definition Frame.h:199
OTC_SDK_API void clear()
Clears the frame data.
OTC_SDK_API Frame clone() const noexcept
Returns a complete copy of this frame.
Definition Frame.h:209
OTC_SDK_API int getWidth() const noexcept
Returns the width in pixels of the frame.
Definition Frame.h:189
OTC_SDK_API void setFromRawData(const void *source)
Sets the frame data values from raw data.
OTC_SDK_API Frame() noexcept
Constructor.
OTC_SDK_API int getHeight() const noexcept
Returns the height in pixel of the frame.
Definition Frame.h:194
Main SDK namespace.
Definition DeviceInfo.h:23