XRPrimer (C++ API)  0.6.0
image.h
Go to the documentation of this file.
1 // Copyright (c) OpenXRLab. All rights reserved.
2 
3 #pragma once
4 
5 #include <memory>
6 #include <stdint.h>
7 #include <vector>
8 
9 enum PixelFormat {
18 };
19 
20 class Image {
21 
22  public:
23  Image();
24  ~Image();
25 
33  Image(int width, int height, PixelFormat format);
34 
43  Image(int width, int height, int widthStep, PixelFormat format);
44 
59  Image(int width, int height, int widthStep, PixelFormat format, void *data);
60 
61  Image(const Image &other);
62  Image(Image &&other);
63  Image &operator=(const Image &other);
64  Image &operator=(Image &&other);
65 
71  int64_t timestamp() const;
72 
78  void set_timestamp(int64_t timestamp);
79 
85  int64_t stream_id() const;
86 
92  void set_stream_id(int64_t stream_id);
93 
99  int width() const;
100 
106  int height() const;
107 
113  PixelFormat format() const;
114 
120  int elemSize() const;
121 
127  int channels() const;
128 
134  int depth() const;
135 
141  int step() const;
142 
148  const void *data() const;
149 
155  void *mutable_data();
156 
162  Image clone() const;
163 
171  bool copyTo(Image *image);
172 
179  bool empty();
180 
181  private:
182  class Impl;
183  std::shared_ptr<Impl> impl_ = nullptr;
184 };
bool empty()
Definition: image.cpp:262
Definition: image.h:14
~Image()
Definition: image.cpp:130
Image clone() const
Definition: image.cpp:237
int depth() const
Image per channel bytes.
Definition: image.cpp:214
void * mutable_data()
Pointer to aligned image data.
Definition: image.cpp:235
Definition: image.cpp:41
Definition: image.h:17
bool copyTo(Image *image)
Definition: image.cpp:245
int width() const
Image width in pixels.
Definition: image.cpp:184
Image & operator=(const Image &other)
Definition: image.cpp:148
Definition: image.h:13
int height() const
Image height in pixels.
Definition: image.cpp:191
int elemSize() const
the size of each pixel in bytes
Definition: image.cpp:205
Definition: image.h:12
PixelFormat format() const
Image format.
Definition: image.cpp:198
int step() const
Size of aligned image row in bytes.
Definition: image.cpp:221
const void * data() const
Pointer to aligned image data.
Definition: image.cpp:228
Definition: image.h:16
int64_t stream_id() const
Image stream index.
Definition: image.cpp:171
int64_t timestamp() const
Image timestamp.
Definition: image.cpp:158
Definition: image.h:10
Definition: image.h:20
Definition: image.h:11
Image()
Definition: image.cpp:128
int channels() const
Image channels, supporet 1,2,3 or 4.
Definition: image.cpp:207
void set_timestamp(int64_t timestamp)
Set the timestamp object.
Definition: image.cpp:165
PixelFormat
Definition: image.h:9
Definition: image.h:15
void set_stream_id(int64_t stream_id)
Set the stream id object.
Definition: image.cpp:178