Skip to content

Commit b83a86e

Browse files
authored
Merge pull request #1808 from luxonis/fix/mt_gpu-stereo
Feature; GPUStereo
2 parents e7d6f1f + 57b8118 commit b83a86e

33 files changed

Lines changed: 542 additions & 6 deletions

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ set(TARGET_CORE_SOURCES
340340
src/pipeline/datatype/ADataType.cpp
341341
src/pipeline/node/PointCloud.cpp
342342
src/pipeline/node/NeuralDepth.cpp
343+
src/pipeline/node/GPUStereo.cpp
343344
src/pipeline/node/NeuralAssistedStereo.cpp
344345
src/pipeline/node/Rectification.cpp
345346
src/pipeline/datatype/Buffer.cpp
@@ -369,6 +370,7 @@ set(TARGET_CORE_SOURCES
369370
src/pipeline/datatype/IMUData.cpp
370371
src/pipeline/datatype/StereoDepthConfig.cpp
371372
src/pipeline/datatype/NeuralDepthConfig.cpp
373+
src/pipeline/datatype/GPUStereoConfig.cpp
372374
src/pipeline/datatype/EdgeDetectorConfig.cpp
373375
src/pipeline/datatype/TrackedFeatures.cpp
374376
src/pipeline/datatype/FeatureTrackerConfig.cpp

bindings/python/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ set(SOURCE_LIST
111111
src/pipeline/node/ImageFiltersBindings.cpp
112112
src/pipeline/node/RectificationBindings.cpp
113113
src/pipeline/node/NeuralDepthBindings.cpp
114+
src/pipeline/node/GPUStereoBindings.cpp
114115
src/pipeline/node/NeuralAssistedStereoBindings.cpp
115116
src/pipeline/FilterParamsBindings.cpp
116117
src/pipeline/node/VppBindings.cpp
@@ -135,6 +136,7 @@ set(SOURCE_LIST
135136
src/pipeline/datatype/MessageGroupBindings.cpp
136137
src/pipeline/datatype/NNDataBindings.cpp
137138
src/pipeline/datatype/NeuralDepthConfigBindings.cpp
139+
src/pipeline/datatype/GPUStereoConfigBindings.cpp
138140
src/pipeline/datatype/RGBDDataBindings.cpp
139141
src/pipeline/datatype/SpatialImgDetectionsBindings.cpp
140142
src/pipeline/datatype/SpatialLocationCalculatorConfigBindings.cpp

bindings/python/src/DatatypeBindings.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ void bind_imudata(pybind11::module& m, void* pCallstack);
2020
void bind_message_group(pybind11::module& m, void* pCallstack);
2121
void bind_nndata(pybind11::module& m, void* pCallstack);
2222
void bind_neuraldepthconfig(pybind11::module& m, void* pCallstack);
23+
void bind_gpustereoconfig(pybind11::module& m, void* pCallstack);
2324
void bind_spatialimgdetections(pybind11::module& m, void* pCallstack);
2425
void bind_segmentationparserconfig(pybind11::module& m, void* pCallstack);
2526
void bind_segmentationmask(pybind11::module& m, void* pCallstack);
@@ -71,6 +72,7 @@ void DatatypeBindings::addToCallstack(std::deque<StackFunction>& callstack) {
7172
callstack.push_front(bind_message_group);
7273
callstack.push_front(bind_nndata);
7374
callstack.push_front(bind_neuraldepthconfig);
75+
callstack.push_front(bind_gpustereoconfig);
7476
callstack.push_front(bind_spatialimgdetections);
7577
callstack.push_front(bind_segmentationparserconfig);
7678
callstack.push_front(bind_segmentationmask);
@@ -142,6 +144,7 @@ void DatatypeBindings::bind(pybind11::module& m, void* pCallstack) {
142144
.value("Tracklets", DatatypeEnum::Tracklets)
143145
.value("IMUData", DatatypeEnum::IMUData)
144146
.value("StereoDepthConfig", DatatypeEnum::StereoDepthConfig)
147+
.value("GPUStereoConfig", DatatypeEnum::GPUStereoConfig)
145148
.value("FeatureTrackerConfig", DatatypeEnum::FeatureTrackerConfig)
146149
.value("ThermalConfig", DatatypeEnum::ThermalConfig)
147150
.value("ToFConfig", DatatypeEnum::ToFConfig)

bindings/python/src/DeviceBindings.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,13 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack) {
10271027
return d.hasGPU();
10281028
},
10291029
DOC(dai, DeviceBase, hasGPU))
1030+
.def(
1031+
"isGpuStereoSupported",
1032+
[](DeviceBase& d) {
1033+
py::gil_scoped_release release;
1034+
return d.isGpuStereoSupported();
1035+
},
1036+
DOC(dai, DeviceBase, isGpuStereoSupported))
10301037
.def(
10311038
"getSupportedDeviceModels",
10321039
[](DeviceBase& d) {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <memory>
2+
3+
#include "DatatypeBindings.hpp"
4+
#include "depthai/pipeline/datatype/GPUStereoConfig.hpp"
5+
#include "pipeline/CommonBindings.hpp"
6+
7+
void bind_gpustereoconfig(pybind11::module& m, void* pCallstack) {
8+
using namespace dai;
9+
10+
py::class_<GPUStereoConfig, Py<GPUStereoConfig>, Buffer, std::shared_ptr<GPUStereoConfig>> gpuStereoConfig(m, "GPUStereoConfig", DOC(dai, GPUStereoConfig));
11+
12+
Callstack* callstack = (Callstack*)pCallstack;
13+
auto cb = callstack->top();
14+
callstack->pop();
15+
cb(m, pCallstack);
16+
17+
gpuStereoConfig.def(py::init<>())
18+
.def("__repr__", &GPUStereoConfig::str)
19+
.def("setConfidenceThreshold", &GPUStereoConfig::setConfidenceThreshold, py::arg("threshold"), DOC(dai, GPUStereoConfig, setConfidenceThreshold))
20+
.def("getConfidenceThreshold", &GPUStereoConfig::getConfidenceThreshold, DOC(dai, GPUStereoConfig, getConfidenceThreshold))
21+
.def_readwrite("confidenceThreshold", &GPUStereoConfig::confidenceThreshold, DOC(dai, GPUStereoConfig, confidenceThreshold));
22+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include "Common.hpp"
2+
#include "NodeBindings.hpp"
3+
#include "depthai/pipeline/Node.hpp"
4+
#include "depthai/pipeline/Pipeline.hpp"
5+
#include "depthai/pipeline/node/GPUStereo.hpp"
6+
7+
void bind_gpustereo(pybind11::module& m, void* pCallstack) {
8+
using namespace dai;
9+
using namespace dai::node;
10+
11+
py::class_<GPUStereoProperties> properties(m, "GPUStereoProperties", DOC(dai, GPUStereoProperties));
12+
auto node = ADD_NODE(GPUStereo);
13+
14+
Callstack* callstack = (Callstack*)pCallstack;
15+
auto cb = callstack->top();
16+
callstack->pop();
17+
cb(m, pCallstack);
18+
19+
properties.def_readwrite("initialConfig", &GPUStereoProperties::initialConfig, DOC(dai, GPUStereoProperties, initialConfig));
20+
21+
node.def_property_readonly(
22+
"left", [](const GPUStereo& n) { return &n.sync->inputs["left"]; }, py::return_value_policy::reference_internal, DOC(dai, node, GPUStereo, left))
23+
.def_property_readonly(
24+
"right", [](const GPUStereo& n) { return &n.sync->inputs["right"]; }, py::return_value_policy::reference_internal, DOC(dai, node, GPUStereo, right))
25+
.def_readonly("initialConfig", &GPUStereo::initialConfig, DOC(dai, node, GPUStereo, initialConfig))
26+
.def("setRectification", &GPUStereo::setRectification, py::arg("enable"), DOC(dai, node, GPUStereo, setRectification))
27+
.def_readonly("disparity", &GPUStereo::disparity, DOC(dai, node, GPUStereo, disparity))
28+
.def_readonly("depth", &GPUStereo::depth, DOC(dai, node, GPUStereo, depth))
29+
.def_readonly("confidenceMap", &GPUStereo::confidenceMap, DOC(dai, node, GPUStereo, confidenceMap))
30+
.def("build", &GPUStereo::build, py::arg("leftInput"), py::arg("rightInput"), DOC(dai, node, GPUStereo, build));
31+
32+
daiNodeModule.attr("GPUStereo").attr("Properties") = properties;
33+
}

bindings/python/src/pipeline/node/NodeBindings.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ void bind_imagealign(pybind11::module& m, void* pCallstack);
186186
void bind_rgbd(pybind11::module& m, void* pCallstack);
187187
void bind_rectification(pybind11::module& m, void* pCallstack);
188188
void bind_neuraldepth(pybind11::module& m, void* pCallstack);
189+
void bind_gpustereo(pybind11::module& m, void* pCallstack);
189190
void bind_neuralassistedstereo(pybind11::module& m, void* pCallstack);
190191
void bind_vpp(pybind11::module& m, void* pCallstack);
191192
void bind_gate(pybind11::module& m, void* pCallstack);
@@ -242,6 +243,7 @@ void NodeBindings::addToCallstack(std::deque<StackFunction>& callstack) {
242243
callstack.push_front(bind_rgbd);
243244
callstack.push_front(bind_rectification);
244245
callstack.push_front(bind_neuraldepth);
246+
callstack.push_front(bind_gpustereo);
245247
callstack.push_front(bind_neuralassistedstereo);
246248
callstack.push_front(bind_vpp);
247249
callstack.push_front(bind_gate);

cmake/Depthai/DepthaiDeviceRVC4Config.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
set(DEPTHAI_DEVICE_RVC4_MATURITY "snapshot")
44

55
# "version if applicable"
6-
set(DEPTHAI_DEVICE_RVC4_VERSION "0.0.1+71eee6ebec2f8f10100f3b1a97e12742cdc1691b")
6+
set(DEPTHAI_DEVICE_RVC4_VERSION "0.0.1+886132476df4489402cd994c995af71a4c6a4d8a")

examples/cpp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ add_subdirectory(NeuralDepth)
165165
add_subdirectory(Segmentation)
166166
add_subdirectory(Vpp)
167167
add_subdirectory(NeuralAssistedStereo)
168+
add_subdirectory(GPUStereo)
168169
add_subdirectory(Gate)
169170
add_subdirectory(PointCloud)
170171
if(DEPTHAI_DYNAMIC_CALIBRATION_SUPPORT)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
project(gpu_stereo_examples)
2+
cmake_minimum_required(VERSION 3.10)
3+
4+
dai_add_example(gpu_stereo gpu_stereo.cpp ON OFF)
5+
dai_set_example_test_labels(gpu_stereo ondevice rvc4 ci)

0 commit comments

Comments
 (0)