camcom 1.0.3
 
Loading...
Searching...
No Matches
data_frame.hpp
Go to the documentation of this file.
1
6
7#ifndef CAMCOM_SERVER_DATA_FRAME_HPP
8#define CAMCOM_SERVER_DATA_FRAME_HPP
9
12#include <vector>
13#include <cstdint>
14
15namespace camcom::server {
16
25struct DataFrame {
26 std::vector<uint8_t> data; // Raw pixel data (interpret via data_type)
27 common::FrameInfo frame_info; // Width, height, frame_id, timestamp, data_type, size
28
29 int width() const { return frame_info.width; }
30 int height() const { return frame_info.height; }
31 common::DataType dataType() const { return frame_info.data_type; }
32 int64_t frameId() const { return frame_info.frame_id; }
33 size_t pixelCount() const { return static_cast<size_t>(frame_info.width) * frame_info.height; }
34
38 static size_t bytesPerPixel(common::DataType dt) {
39 switch (dt) {
40 case common::DataType::BYTE: return 1;
41 case common::DataType::INT16: return 2;
42 case common::DataType::UINT16: return 2;
43 case common::DataType::INT32: return 4;
44 case common::DataType::UINT32: return 4;
45 case common::DataType::INT64: return 8;
46 case common::DataType::UINT64: return 8;
47 case common::DataType::FLOAT: return 4;
48 case common::DataType::DOUBLE: return 8;
49 default: return 1;
50 }
51 }
52
53 size_t bytesPerPixel() const { return bytesPerPixel(dataType()); }
54};
55
56} // namespace camcom::server
57
58#endif // CAMCOM_SERVER_DATA_FRAME_HPP
Definition frameInfo.hpp:23
CamCom data type — re-export of the ELT IFW (ifw-fnd) data type.
Header file for the CamCom Common Library.
ifw::fnd::datatype::DataType DataType
Definition datatype.hpp:27
Definition adapter_loader.cpp:11
Container for a single frame of image data with metadata.
Definition data_frame.hpp:25
static size_t bytesPerPixel(common::DataType dt)
Bytes per pixel element for the current data type.
Definition data_frame.hpp:38
int width() const
Definition data_frame.hpp:29
size_t pixelCount() const
Definition data_frame.hpp:33
size_t bytesPerPixel() const
Definition data_frame.hpp:53
common::DataType dataType() const
Definition data_frame.hpp:31
std::vector< uint8_t > data
Definition data_frame.hpp:26
common::FrameInfo frame_info
Definition data_frame.hpp:27
int height() const
Definition data_frame.hpp:30
int64_t frameId() const
Definition data_frame.hpp:32