TinyURDF 1.0.0
A Modern C++ Library for Parsing and Visualizing URDF Model Files
Loading...
Searching...
No Matches
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 2025 Wiisem CHIHA
5
6#include <vector>
7#include <utility>
8#include <cstddef>
9
10template <typename T = double, std::size_t Channels = 4>
11class Image {
12public:
14 using value_type = T;
16 Image();
18 Image(const Image& other);
20 Image(Image&& other) noexcept;
22 Image(std::size_t width, std::size_t height);
30 Image(const T* data, std::size_t width, std::size_t height);
32 T* data() noexcept;
33 const T* data() const noexcept;
35 std::size_t width() const;
37 std::size_t height() const;
39 constexpr std::size_t channels() const;
41 constexpr std::size_t size() const;
43 T& operator[](std::size_t offset);
44 const T& operator[](std::size_t offset) const;
45 private:
46 std::size_t m_width;
47 std::size_t m_height;
48 std::vector<T> m_data;
49};
50#endif // INCLUDE_TINYURDF_CORE_IMAGE_H_
Definition image.h:11
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:14
T * data() noexcept
Get direct access to the underlying data.
Definition image.cc:23
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