forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpyrs_types.cpp
67 lines (62 loc) · 2.68 KB
/
pyrs_types.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* License: Apache 2.0. See LICENSE file in root directory.
Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
#include "pyrealsense2.h"
#include <librealsense2/hpp/rs_types.hpp>
void init_types(py::module &m) {
/** rs2_types.hpp **/
// error+subclasses
enum product_line
{
any = RS2_PRODUCT_LINE_ANY,
any_intel = RS2_PRODUCT_LINE_ANY_INTEL,
non_intel = RS2_PRODUCT_LINE_NON_INTEL,
D400 = RS2_PRODUCT_LINE_D400,
D500 = RS2_PRODUCT_LINE_D500,
SR300 = RS2_PRODUCT_LINE_SR300,
L500 = RS2_PRODUCT_LINE_L500,
T200 = RS2_PRODUCT_LINE_T200,
DEPTH = RS2_PRODUCT_LINE_DEPTH,
TRACKING = RS2_PRODUCT_LINE_TRACKING,
sw_only = RS2_PRODUCT_LINE_SW_ONLY
};
py::enum_< product_line >( m, "product_line" )
.value( "any", product_line::any )
.value( "any_intel", product_line::any_intel )
.value( "non_intel", product_line::non_intel )
.value( "sw_only", product_line::sw_only )
.value( "D400", product_line::D400 )
.value( "D500", product_line::D500 )
.value( "SR300", product_line::SR300 )
.value( "L500", product_line::L500 )
.value( "T200", product_line::T200 )
.value( "DEPTH", product_line::DEPTH )
.value( "TRACKING", product_line::TRACKING )
.export_values();
py::class_<rs2::option_range> option_range(m, "option_range"); // No docstring in C++
option_range.def(py::init<>())
.def( py::init(
[]( float min, float max, float step, float default_value ) {
return rs2::option_range{ min, max, step, default_value };
} ),
"min"_a,
"max"_a,
"step"_a,
"default"_a )
.def_readwrite("min", &rs2::option_range::min)
.def_readwrite("max", &rs2::option_range::max)
.def_readwrite("default", &rs2::option_range::def)
.def_readwrite("step", &rs2::option_range::step)
.def("__repr__", [](const rs2::option_range &self) {
std::stringstream ss;
ss << "<" SNAME ".option_range: " << self.min << "-" << self.max
<< "/" << self.step << " [" << self.def << "]>";
return ss.str();
});
py::class_<rs2::region_of_interest> region_of_interest(m, "region_of_interest"); // No docstring in C++
region_of_interest.def(py::init<>())
.def_readwrite("min_x", &rs2::region_of_interest::min_x)
.def_readwrite("min_y", &rs2::region_of_interest::min_y)
.def_readwrite("max_x", &rs2::region_of_interest::max_x)
.def_readwrite("max_y", &rs2::region_of_interest::max_y);
/** end rs_types.hpp **/
}