types.h
Go to the documentation of this file.
1 #ifndef USB_CAM_TYPES_H
2 #define USB_CAM_TYPES_H
3 
4 #include <vector>
5 #include <string>
6 #include <chrono>
7 #include <memory>
8 #include <sstream>
9 #include <string>
10 #include <vector>
11 #include <cmath>
12 #include <ctime>
13 #include <climits>
14 #include <cstring>
15 #include <stdexcept>
16 
17 #include <asm/types.h> // for videodev2.h
18 #include <linux/videodev2.h>
19 #include <sys/ioctl.h>
20 #include <sys/time.h>
21 
22 #include <opencv2/imgproc.hpp>
23 
24 namespace usb_cam
25 {
26 namespace constants
27 {
28 
29 static const std::vector<unsigned char> uchar_clipping_table = {
30  0, 0, 0, 0, 0, 0, 0, 0, // -128 - -121
31  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // -120 - -101
32  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // -100 - -81
33  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // -80 - -61
34  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // -60 - -41
35  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // -40 - -21
36  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // -20 - -1
37  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
38  21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
39  41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
40  61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
41  81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
42  101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
43  116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
44  131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
45  146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160,
46  161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
47  176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
48  191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
49  206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
50  221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235,
51  236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
52  251, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 256-263
53  255, 255, 255, 255, 255, 255, 255, 255, // 264-271
54  255, 255, 255, 255, 255, 255, 255, 255, // 272-279
55  255, 255, 255, 255, 255, 255, 255, 255, // 280-287
56  255, 255, 255, 255, 255, 255, 255, 255, // 288-295
57  255, 255, 255, 255, 255, 255, 255, 255, // 296-303
58  255, 255, 255, 255, 255, 255, 255, 255, // 304-311
59  255, 255, 255, 255, 255, 255, 255, 255, // 312-319
60  255, 255, 255, 255, 255, 255, 255, 255, // 320-327
61  255, 255, 255, 255, 255, 255, 255, 255, // 328-335
62  255, 255, 255, 255, 255, 255, 255, 255, // 336-343
63  255, 255, 255, 255, 255, 255, 255, 255, // 344-351
64  255, 255, 255, 255, 255, 255, 255, 255, // 352-359
65  255, 255, 255, 255, 255, 255, 255, 255, // 360-367
66  255, 255, 255, 255, 255, 255, 255, 255, // 368-375
67  255, 255, 255, 255, 255, 255, 255, 255, // 376-383
68 };
69 
70 static const int clipping_table_offset = 128;
71 
72 } // namespace constants
73 
75 {
80  };
81 
82 
84 {
95 };
96 
97 
99 {
103 };
104 
105 
106 struct buffer
107 {
108  void * start;
109  std::size_t length;
110 };
111 
113 {
114  uint32_t width;
115  uint32_t height;
116  uint32_t step;
117  std::string encoding;
120  struct timespec stamp;
121  char * image;
122  int is_new;
123 };
124 
126 {
127  struct v4l2_fmtdesc format;
128  struct v4l2_frmsizeenum size;
129  struct v4l2_frmivalenum interval;
130 };
131 
133 {
134  v4l2_ctrl_type type;
135  std::string name;
136  std::string description;
137  std::string value;
138 };
139 
140 } // namespace usb_cam
141 
142 #endif // USB_CAM_TYPES_H
usb_cam::camera_control_t::type
v4l2_ctrl_type type
Definition: types.h:134
usb_cam::camera_image_t::step
uint32_t step
Definition: types.h:116
usb_cam::camera_image_t::encoding
std::string encoding
Definition: types.h:117
usb_cam
Definition: camera_driver.h:35
usb_cam::IO_METHOD_READ
@ IO_METHOD_READ
Definition: types.h:76
usb_cam::camera_image_t::image_size
int image_size
Definition: types.h:119
usb_cam::camera_control_t::name
std::string name
Definition: types.h:135
usb_cam::camera_image_t
Definition: types.h:112
usb_cam::PIXEL_FORMAT_H264
@ PIXEL_FORMAT_H264
Definition: types.h:93
usb_cam::camera_control_t::description
std::string description
Definition: types.h:136
usb_cam::camera_image_t::width
uint32_t width
Definition: types.h:114
usb_cam::camera_image_t::stamp
struct timespec stamp
Definition: types.h:120
usb_cam::PIXEL_FORMAT_UYVY
@ PIXEL_FORMAT_UYVY
Definition: types.h:86
usb_cam::constants::uchar_clipping_table
static const std::vector< unsigned char > uchar_clipping_table
Definition: types.h:29
usb_cam::PIXEL_FORMAT_GREY
@ PIXEL_FORMAT_GREY
Definition: types.h:91
usb_cam::PIXEL_FORMAT_YUYV
@ PIXEL_FORMAT_YUYV
Definition: types.h:85
usb_cam::capture_format_t::format
struct v4l2_fmtdesc format
Definition: types.h:127
usb_cam::PIXEL_FORMAT_BGR24
@ PIXEL_FORMAT_BGR24
Definition: types.h:90
usb_cam::COLOR_FORMAT_YUV422P
@ COLOR_FORMAT_YUV422P
Definition: types.h:101
usb_cam::capture_format_t::size
struct v4l2_frmsizeenum size
Definition: types.h:128
usb_cam::camera_image_t::image
char * image
Definition: types.h:121
usb_cam::buffer::length
std::size_t length
Definition: types.h:109
usb_cam::camera_control_t
Definition: types.h:132
usb_cam::camera_image_t::is_new
int is_new
Definition: types.h:122
usb_cam::camera_image_t::height
uint32_t height
Definition: types.h:115
usb_cam::buffer::start
void * start
Definition: types.h:108
usb_cam::PIXEL_FORMAT_YU12
@ PIXEL_FORMAT_YU12
Definition: types.h:92
usb_cam::PIXEL_FORMAT_RGB24
@ PIXEL_FORMAT_RGB24
Definition: types.h:89
usb_cam::capture_format_t
Definition: types.h:125
usb_cam::PIXEL_FORMAT_MJPEG
@ PIXEL_FORMAT_MJPEG
Definition: types.h:87
usb_cam::color_format_t
color_format_t
Definition: types.h:98
usb_cam::capture_format_t::interval
struct v4l2_frmivalenum interval
Definition: types.h:129
usb_cam::buffer
Definition: types.h:106
usb_cam::pixel_format_t
pixel_format_t
Definition: types.h:83
usb_cam::IO_METHOD_MMAP
@ IO_METHOD_MMAP
Definition: types.h:77
usb_cam::PIXEL_FORMAT_YUVMONO10
@ PIXEL_FORMAT_YUVMONO10
Definition: types.h:88
usb_cam::io_method_t
io_method_t
Definition: types.h:74
usb_cam::constants::clipping_table_offset
static const int clipping_table_offset
Definition: types.h:70
usb_cam::camera_control_t::value
std::string value
Definition: types.h:137
usb_cam::COLOR_FORMAT_UNKNOWN
@ COLOR_FORMAT_UNKNOWN
Definition: types.h:102
usb_cam::COLOR_FORMAT_YUV420P
@ COLOR_FORMAT_YUV420P
Definition: types.h:100
usb_cam::IO_METHOD_USERPTR
@ IO_METHOD_USERPTR
Definition: types.h:78
usb_cam::camera_image_t::bytes_per_pixel
int bytes_per_pixel
Definition: types.h:118
usb_cam::IO_METHOD_UNKNOWN
@ IO_METHOD_UNKNOWN
Definition: types.h:79
usb_cam::PIXEL_FORMAT_UNKNOWN
@ PIXEL_FORMAT_UNKNOWN
Definition: types.h:94


usb_cam
Author(s): Benjamin Pitzer
autogenerated on Fri Apr 12 2024 02:42:53