Loading [MathJax]/extensions/tex2jax.js
TinyURDF 1.0.0
All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
image.h
Go to the documentation of this file.
1#ifndef INCLUDE_TINYURDF_CORE_IMAGE_H_
2#define INCLUDE_TINYURDF_CORE_IMAGE_H_
3
4// Copyright 2024-2025 Wissem CHIHA
5
6#include <loguru/loguru.hpp>
7#include <string>
8#include <vector>
9
16template <typename T = double, std::size_t Channels = 4>
17class Image
18{
19 public:
21 using value_type = T;
22
24 Image();
25
27 Image(const Image& other);
28
30 Image(Image&& other) noexcept;
31
33 Image(std::size_t width, std::size_t height);
34
42 Image(const T* data, std::size_t width, std::size_t height);
43
45 T* data() noexcept;
46
48 const T* data() const noexcept;
49
51 std::size_t width() const;
52
54 std::size_t height() const;
55
57 constexpr std::size_t channels() const;
58
60 constexpr std::size_t size() const;
61
63 T& operator[](std::size_t offset);
64
66 const T& operator[](std::size_t offset) const;
67
69 Image& operator=(const Image& other);
70
71 private:
72 std::size_t m_width;
73 std::size_t m_height;
74 std::vector<T> m_data;
75};
76#endif // INCLUDE_TINYURDF_CORE_IMAGE_H_
base image class definition
Definition image.h:18
constexpr std::size_t size() const
Get the size of the data array containing the image.
Definition image.cc:48
T value_type
Alias for the type used to represent individual pixel values.
Definition image.h:21
T * data() noexcept
get direct access to the underlying data
Definition image.cc:28
constexpr std::size_t channels() const
Get the number of channels in the image.
Definition image.cc:43
Image()
Default-construct a new image object.
Definition image.cc:4
std::size_t width() const
Get the width of the image.
Definition image.cc:33
std::size_t height() const
Get the height of the image.
Definition image.cc:38