EduArt Sensor Ring Library 4.0.0
Loading...
Searching...
No Matches
Image.hpp
Go to the documentation of this file.
1// Copyright (c) 2026 EduArt Robotik GmbH
2
9
10#pragma once
11
12#include <array>
13
14#include "sensorring/platform/SensorringExport.hpp"
15
16namespace eduart {
17
18namespace sensorring {
19
21static constexpr unsigned int THERMAL_RESOLUTION = 1024;
22
24static constexpr unsigned int MAX_MSG_LENGTH = 64;
25
26namespace measurement {
27
32template <typename T, std::size_t RESOLUTION> struct SENSORRING_EXPORT ScalarImage {
33 static_assert(std::is_arithmetic<T>::value, "T must be an arithmetic type");
34
36 std::array<T, RESOLUTION> data = {};
37
44 void copyTo(T* buffer, int size);
45
50 double avg();
51
57
62 ScalarImage& operator/=(const T other);
63
68 ScalarImage& operator+=(const T other);
69
74 ScalarImage& operator-=(const T other);
75
81
87
92 template <typename U> ScalarImage& operator+=(const ScalarImage<U, RESOLUTION>& other);
93
98 template <typename U> ScalarImage& operator-=(const ScalarImage<U, RESOLUTION>& other);
99};
100
105template <typename T, std::size_t RESOLUTION> struct SENSORRING_EXPORT RgbImage {
106 static_assert(std::is_arithmetic<T>::value, "T must be an arithmetic type");
107
109 std::array<std::array<T, 3>, RESOLUTION> data = {};
110
117 void copyTo(T* buffer, int size);
118};
119
120} // namespace measurement
121
122} // namespace sensorring
123
124} // namespace eduart
static constexpr unsigned int THERMAL_RESOLUTION
Thermal image resolution constant (32x32).
Definition Image.hpp:21
static constexpr unsigned int MAX_MSG_LENGTH
Maximum message length in bytes.
Definition Image.hpp:24
Template for images with three channels (R, G, B) and variable arithmetic type.
Definition Image.hpp:105
void copyTo(T *buffer, int size)
Copy image data to a pre-allocated buffer (flattened: R,G,B,R,G,B,...).
std::array< std::array< T, 3 >, RESOLUTION > data
Internal data structure for the image.
Definition Image.hpp:109
Template for images with one scalar value per pixel and variable arithmetic type.
Definition Image.hpp:32
ScalarImage & operator+=(const ScalarImage &other)
Add two ScalarImage images pixel wise.
ScalarImage & operator+=(const ScalarImage< U, RESOLUTION > &other)
Add two ScalarImage images of different data types pixel wise.
ScalarImage & operator/=(const T other)
Divide each pixel by the same value.
ScalarImage & operator-=(const ScalarImage &other)
Subtract two ScalarImage images pixel wise.
ScalarImage & round()
Round each pixel value when a floating point type is used.
ScalarImage & operator-=(const T other)
Subtract the same value from each pixel.
std::array< T, RESOLUTION > data
Internal data structure for the image.
Definition Image.hpp:36
double avg()
Calculate the average over all pixels.
ScalarImage & operator-=(const ScalarImage< U, RESOLUTION > &other)
Subtract two ScalarImage images of different data types pixel wise.
ScalarImage & operator+=(const T other)
Add the same value to each pixel.
void copyTo(T *buffer, int size)
Copy image data to a pre-allocated buffer.