From 73991ab7941a3468399ef5c31547f854bc08544d Mon Sep 17 00:00:00 2001 From: alex-luxonis Date: Thu, 6 Apr 2023 05:47:01 +0300 Subject: [PATCH 001/105] FW: support for IMX283, at almost full resolution: 5312x3692, FPS max 20, note: exposure control not working properly, and lower FPS would apply longer exposure --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 125feb8c2..0b8c5d374 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 125feb8c2e16ee4bf71b7873a7b990f1c5f17b18 +Subproject commit 0b8c5d374efc08b4bbb6f62b491aea167f1c89ba From 334b7d3a471c0ad727d1a70443015d8d21f801d8 Mon Sep 17 00:00:00 2001 From: alex-luxonis Date: Mon, 17 Apr 2023 16:26:20 +0300 Subject: [PATCH 002/105] Update FW: IMX283 exposure and ISO setting fixed, added 4K res (but has issues at higher FPS, about `> 19`), fixed a depthai crash with camera FPS set `< 0.5` --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 0b8c5d374..0eca08e9b 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 0b8c5d374efc08b4bbb6f62b491aea167f1c89ba +Subproject commit 0eca08e9b25c26e71abcee3a959de6de2a4f6529 From ed15db5d6aaa9862a2126afeddecbff39090c458 Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 24 Aug 2023 13:53:58 +0200 Subject: [PATCH 003/105] Added out binding to VideoEncoder --- src/pipeline/node/VideoEncoderBindings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pipeline/node/VideoEncoderBindings.cpp b/src/pipeline/node/VideoEncoderBindings.cpp index 4f2045b64..db9e3a860 100644 --- a/src/pipeline/node/VideoEncoderBindings.cpp +++ b/src/pipeline/node/VideoEncoderBindings.cpp @@ -59,6 +59,7 @@ void bind_videoencoder(pybind11::module& m, void* pCallstack){ videoEncoder .def_readonly("input", &VideoEncoder::input, DOC(dai, node, VideoEncoder, input), DOC(dai, node, VideoEncoder, input)) .def_readonly("bitstream", &VideoEncoder::bitstream, DOC(dai, node, VideoEncoder, bitstream), DOC(dai, node, VideoEncoder, bitstream)) + .def_readonly("out", &VideoEncoder::out, DOC(dai, node, VideoEncoder, out), DOC(dai, node, VideoEncoder, out)) .def("setDefaultProfilePreset", static_cast(&VideoEncoder::setDefaultProfilePreset), py::arg("fps"), py::arg("profile"), DOC(dai, node, VideoEncoder, setDefaultProfilePreset)) .def("setDefaultProfilePreset", [](VideoEncoder& v, int width, int height, float fps, VideoEncoderProperties::Profile profile){ PyErr_WarnEx(PyExc_DeprecationWarning, "Input width/height no longer needed, automatically determined from first frame", 1); From 5f655c65c85a8087ab34ddc2e07d96befe07f1ab Mon Sep 17 00:00:00 2001 From: asahtik Date: Fri, 25 Aug 2023 10:27:06 +0200 Subject: [PATCH 004/105] Added python bindings on host side --- CMakeLists.txt | 1 + src/DatatypeBindings.cpp | 3 + .../datatype/EncodedFrameBindings.cpp | 111 ++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 src/pipeline/datatype/EncodedFrameBindings.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d8fc4fee8..1348bad35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,6 +141,7 @@ pybind11_add_module(${TARGET_NAME} src/pipeline/datatype/ImageManipConfigBindings.cpp src/pipeline/datatype/ImgDetectionsBindings.cpp src/pipeline/datatype/ImgFrameBindings.cpp + src/pipeline/datatype/EncodedFrameBindings.cpp src/pipeline/datatype/IMUDataBindings.cpp src/pipeline/datatype/NNDataBindings.cpp src/pipeline/datatype/SpatialImgDetectionsBindings.cpp diff --git a/src/DatatypeBindings.cpp b/src/DatatypeBindings.cpp index 5ff683f3d..9c8104d0b 100644 --- a/src/DatatypeBindings.cpp +++ b/src/DatatypeBindings.cpp @@ -13,6 +13,7 @@ void bind_featuretrackerconfig(pybind11::module& m, void* pCallstack); void bind_imagemanipconfig(pybind11::module& m, void* pCallstack); void bind_imgdetections(pybind11::module& m, void* pCallstack); void bind_imgframe(pybind11::module& m, void* pCallstack); +void bind_encodedframe(pybind11::module& m, void* pCallstack); void bind_imudata(pybind11::module& m, void* pCallstack); void bind_nndata(pybind11::module& m, void* pCallstack); void bind_spatialimgdetections(pybind11::module& m, void* pCallstack); @@ -39,6 +40,7 @@ void DatatypeBindings::addToCallstack(std::deque& callstack) { callstack.push_front(bind_imagemanipconfig); callstack.push_front(bind_imgdetections); callstack.push_front(bind_imgframe); + callstack.push_front(bind_encodedframe); callstack.push_front(bind_imudata); callstack.push_front(bind_nndata); callstack.push_front(bind_spatialimgdetections); @@ -74,6 +76,7 @@ void DatatypeBindings::bind(pybind11::module& m, void* pCallstack){ datatypeEnum .value("Buffer", DatatypeEnum::Buffer) .value("ImgFrame", DatatypeEnum::ImgFrame) + .value("EncodedFrame", DatatypeEnum::EncodedFrame) .value("NNData", DatatypeEnum::NNData) .value("ImageManipConfig", DatatypeEnum::ImageManipConfig) .value("CameraControl", DatatypeEnum::CameraControl) diff --git a/src/pipeline/datatype/EncodedFrameBindings.cpp b/src/pipeline/datatype/EncodedFrameBindings.cpp new file mode 100644 index 000000000..5d39c1731 --- /dev/null +++ b/src/pipeline/datatype/EncodedFrameBindings.cpp @@ -0,0 +1,111 @@ +#include "DatatypeBindings.hpp" +#include "pipeline/CommonBindings.hpp" +#include +#include + +// depthai +#include "depthai/pipeline/datatype/EncodedFrame.hpp" + +//pybind +#include +#include + +void bind_encodedframe(pybind11::module& m, void* pCallstack){ + + using namespace dai; + + py::class_> rawEncodedFrame(m, "RawEncodedFrame", DOC(dai, RawEncodedFrame)); + py::enum_ rawEncodedFrameProfile(rawEncodedFrame, "Profile"); + py::enum_ rawEncodedFrameType(rawEncodedFrame, "FrameType", DOC(dai, RawEncodedFrame, FrameType)); + py::class_> encodedFrame(m, "EncodedFrame", DOC(dai, EncodedFrame)); + + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + // Call the rest of the type defines, then perform the actual bindings + Callstack* callstack = (Callstack*) pCallstack; + auto cb = callstack->top(); + callstack->pop(); + cb(m, pCallstack); + // Actual bindings + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + + // Metadata / raw + + rawEncodedFrame + .def(py::init<>()) + .def_readwrite("height", &RawEncodedFrame::height) + .def_readwrite("width", &RawEncodedFrame::width) + .def_readwrite("quality", &RawEncodedFrame::quality) + .def_readwrite("profile", &RawEncodedFrame::profile) + .def_readwrite("lossless", &RawEncodedFrame::lossless) + .def_readwrite("type", &RawEncodedFrame::type) + .def_readwrite("sequenceNum", &RawEncodedFrame::sequenceNum) + .def_property("ts", + [](const RawEncodedFrame& o){ + double ts = o.ts.sec + o.ts.nsec / 1000000000.0; + return ts; + }, + [](RawEncodedFrame& o, double ts){ + o.ts.sec = ts; + o.ts.nsec = (ts - o.ts.sec) * 1000000000.0; + } + ) + .def_property("tsDevice", + [](const RawEncodedFrame& o){ + double ts = o.tsDevice.sec + o.tsDevice.nsec / 1000000000.0; + return ts; + }, + [](RawEncodedFrame& o, double ts){ + o.tsDevice.sec = ts; + o.tsDevice.nsec = (ts - o.tsDevice.sec) * 1000000000.0; + } + ) + ; + + + rawEncodedFrameProfile + .value("JPEG", EncodedFrame::Profile::JPEG) + .value("AVC", EncodedFrame::Profile::AVC) + .value("HEVC", EncodedFrame::Profile::HEVC) + ; + + rawEncodedFrameType + .value("I", EncodedFrame::FrameType::I) + .value("P", EncodedFrame::FrameType::P) + .value("B", EncodedFrame::FrameType::B) + ; + + // Message + encodedFrame + .def(py::init<>()) + // getters + .def("getTimestamp", py::overload_cast<>(&EncodedFrame::getTimestamp, py::const_), DOC(dai, EncodedFrame, getTimestamp)) + .def("getTimestampDevice", py::overload_cast<>(&EncodedFrame::getTimestampDevice, py::const_), DOC(dai, EncodedFrame, getTimestampDevice)) + .def("getSequenceNum", &EncodedFrame::getSequenceNum, DOC(dai, EncodedFrame, getSequenceNum)) + .def("getWidth", &EncodedFrame::getWidth, DOC(dai, EncodedFrame, getWidth)) + .def("getHeight", &EncodedFrame::getHeight, DOC(dai, EncodedFrame, getHeight)) + .def("getQuality", &EncodedFrame::getQuality, DOC(dai, EncodedFrame, getQuality)) + .def("getFrameType", &EncodedFrame::getFrameType, DOC(dai, EncodedFrame, getFrameType)) + .def("getLossless", &EncodedFrame::getLossless, DOC(dai, EncodedFrame, getLossless)) + .def("getProfile", &EncodedFrame::getProfile, DOC(dai, EncodedFrame, getProfile)) + + // setters + .def("setTimestamp", &EncodedFrame::setTimestamp, DOC(dai, EncodedFrame, setTimestamp)) + .def("setTimestampDevice", &EncodedFrame::setTimestampDevice, DOC(dai, EncodedFrame, setTimestampDevice)) + .def("setSequenceNum", &EncodedFrame::setSequenceNum, DOC(dai, EncodedFrame, getSequenceNum)) + .def("setWidth", &EncodedFrame::setWidth, DOC(dai, EncodedFrame, getWidth)) + .def("setHeight", &EncodedFrame::setHeight, DOC(dai, EncodedFrame, getHeight)) + .def("setSize", static_cast(&EncodedFrame::setSize), py::arg("width"), py::arg("height"), DOC(dai, EncodedFrame, setSize)) + .def("setSize", static_cast)>(&EncodedFrame::setSize), py::arg("size"), DOC(dai, EncodedFrame, setSize, 2)) + .def("setQuality", &EncodedFrame::setQuality, DOC(dai, EncodedFrame, getQuality)) + .def("setFrameType", &EncodedFrame::setFrameType, DOC(dai, EncodedFrame, getFrameType)) + .def("setLossless", &EncodedFrame::setLossless, DOC(dai, EncodedFrame, getLossless)) + .def("setProfile", &EncodedFrame::setProfile, DOC(dai, EncodedFrame, getProfile)) + ; + // add aliases dai.ImgFrame.Type and dai.ImgFrame.Specs + m.attr("EncodedFrame").attr("FrameType") = m.attr("RawEncodedFrame").attr("FrameType"); + m.attr("EncodedFrame").attr("Profile") = m.attr("RawEncodedFrame").attr("Profile"); +} From eb7a6b0afe7b3bb17c6917a9380b0af9d4a5e5d6 Mon Sep 17 00:00:00 2001 From: asahtik Date: Tue, 29 Aug 2023 15:56:03 +0200 Subject: [PATCH 005/105] Added unknown frame type --- src/pipeline/datatype/EncodedFrameBindings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pipeline/datatype/EncodedFrameBindings.cpp b/src/pipeline/datatype/EncodedFrameBindings.cpp index 5d39c1731..90de0dff4 100644 --- a/src/pipeline/datatype/EncodedFrameBindings.cpp +++ b/src/pipeline/datatype/EncodedFrameBindings.cpp @@ -76,6 +76,7 @@ void bind_encodedframe(pybind11::module& m, void* pCallstack){ .value("I", EncodedFrame::FrameType::I) .value("P", EncodedFrame::FrameType::P) .value("B", EncodedFrame::FrameType::B) + .value("Unknown", EncodedFrame::FrameType::Unknown) ; // Message From d8a7042e5b8961cb576fd74ad134df4bef12e766 Mon Sep 17 00:00:00 2001 From: Aniel Alexa Date: Wed, 6 Sep 2023 17:19:59 +0300 Subject: [PATCH 006/105] bindings for getConnectivity --- depthai-core | 2 +- src/DeviceBindings.cpp | 1 + src/pipeline/CommonBindings.cpp | 9 ++++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/depthai-core b/depthai-core index 517ce9384..3aa5d54c5 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 517ce9384e4de25bec81eff31b390726a429d76f +Subproject commit 3aa5d54c55a9978e85a92bb55acc0feb7255a110 diff --git a/src/DeviceBindings.cpp b/src/DeviceBindings.cpp index afd3c99eb..0460e75c6 100644 --- a/src/DeviceBindings.cpp +++ b/src/DeviceBindings.cpp @@ -611,6 +611,7 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){ .def("getCrashDump", [](DeviceBase& d, bool clearCrashDump) { py::gil_scoped_release release; return d.getCrashDump(clearCrashDump); }, py::arg("clearCrashDump") = true, DOC(dai, DeviceBase, getCrashDump)) .def("hasCrashDump", [](DeviceBase& d) { py::gil_scoped_release release; return d.hasCrashDump(); }, DOC(dai, DeviceBase, hasCrashDump)) .def("getConnectedCameras", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectedCameras(); }, DOC(dai, DeviceBase, getConnectedCameras)) + .def("getConnectivity", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectivity(); }, DOC(dai, DeviceBase, getConnectivity)) .def("getConnectedCameraFeatures", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectedCameraFeatures(); }, DOC(dai, DeviceBase, getConnectedCameraFeatures)) .def("getCameraSensorNames", [](DeviceBase& d) { py::gil_scoped_release release; return d.getCameraSensorNames(); }, DOC(dai, DeviceBase, getCameraSensorNames)) .def("getConnectedIMU", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectedIMU(); }, DOC(dai, DeviceBase, getConnectedIMU)) diff --git a/src/pipeline/CommonBindings.cpp b/src/pipeline/CommonBindings.cpp index eaeb0bab0..ff8b84e6a 100644 --- a/src/pipeline/CommonBindings.cpp +++ b/src/pipeline/CommonBindings.cpp @@ -5,6 +5,7 @@ // depthai-shared #include "depthai-shared/common/CameraBoardSocket.hpp" +#include "depthai-shared/common/Connectivity.hpp" #include "depthai-shared/common/EepromData.hpp" #include "depthai-shared/common/CameraImageOrientation.hpp" #include "depthai-shared/common/CameraSensorType.hpp" @@ -40,6 +41,7 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack){ py::class_ point3f(m, "Point3f", DOC(dai, Point3f)); py::class_ size2f(m, "Size2f", DOC(dai, Size2f)); py::enum_ cameraBoardSocket(m, "CameraBoardSocket", DOC(dai, CameraBoardSocket)); + py::enum_ connectivity(m, "Connectivity", DOC(dai, Connectivity)); py::enum_ cameraSensorType(m, "CameraSensorType", DOC(dai, CameraSensorType)); py::enum_ cameraImageOrientation(m, "CameraImageOrientation", DOC(dai, CameraImageOrientation)); py::class_ cameraSensorConfig(m, "CameraSensorConfig", DOC(dai, CameraSensorConfig)); @@ -183,7 +185,12 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack){ .value("TOF", CameraSensorType::TOF) .value("THERMAL", CameraSensorType::THERMAL) ; - + // Connectivity enum bindings + connectivity + .value("USB", Connectivity::USB) + .value("ETHERNET", Connectivity::ETHERNET) + .value("WIFI", Connectivity::WIFI) + ; // CameraImageOrientation enum bindings cameraImageOrientation .value("AUTO", CameraImageOrientation::AUTO) From 03d57d501022cf3d5cd5f2cac7198c7e537b82cb Mon Sep 17 00:00:00 2001 From: Aniel Alexa Date: Thu, 7 Sep 2023 15:25:53 +0300 Subject: [PATCH 007/105] depthai-core dependiences --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 3aa5d54c5..6d43342ae 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 3aa5d54c55a9978e85a92bb55acc0feb7255a110 +Subproject commit 6d43342ae8d61002c80e44c085b30821095fc722 From b9c95c433ac912266f0c4dfb206a03737de2604f Mon Sep 17 00:00:00 2001 From: asahtik Date: Tue, 12 Sep 2023 09:31:33 +0200 Subject: [PATCH 008/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 1c5fe7d07..8fd236524 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 1c5fe7d075e67d5c722ab2851218582404eac35a +Subproject commit 8fd2365243198147f5e4d062ff81b17538ff059e From ddaa16aca4789cc22662581c8862f053066de21a Mon Sep 17 00:00:00 2001 From: asahtik Date: Tue, 19 Sep 2023 13:39:50 +0200 Subject: [PATCH 009/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 8fd236524..32e32009f 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 8fd2365243198147f5e4d062ff81b17538ff059e +Subproject commit 32e32009f8cf79d596b6b6e15295d3ad673d8aef From 4b9c9e79602113f415041c8511f19990df992967 Mon Sep 17 00:00:00 2001 From: asahtik Date: Tue, 19 Sep 2023 15:13:37 +0200 Subject: [PATCH 010/105] EncFrm fixes --- depthai-core | 2 +- src/pipeline/datatype/EncodedFrameBindings.cpp | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/depthai-core b/depthai-core index 32e32009f..60c0b299c 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 32e32009f8cf79d596b6b6e15295d3ad673d8aef +Subproject commit 60c0b299c010edf27ae0ee88bc07d4e35517b02d diff --git a/src/pipeline/datatype/EncodedFrameBindings.cpp b/src/pipeline/datatype/EncodedFrameBindings.cpp index 90de0dff4..80fdc22ca 100644 --- a/src/pipeline/datatype/EncodedFrameBindings.cpp +++ b/src/pipeline/datatype/EncodedFrameBindings.cpp @@ -36,8 +36,6 @@ void bind_encodedframe(pybind11::module& m, void* pCallstack){ rawEncodedFrame .def(py::init<>()) - .def_readwrite("height", &RawEncodedFrame::height) - .def_readwrite("width", &RawEncodedFrame::width) .def_readwrite("quality", &RawEncodedFrame::quality) .def_readwrite("profile", &RawEncodedFrame::profile) .def_readwrite("lossless", &RawEncodedFrame::lossless) @@ -86,8 +84,6 @@ void bind_encodedframe(pybind11::module& m, void* pCallstack){ .def("getTimestamp", py::overload_cast<>(&EncodedFrame::getTimestamp, py::const_), DOC(dai, EncodedFrame, getTimestamp)) .def("getTimestampDevice", py::overload_cast<>(&EncodedFrame::getTimestampDevice, py::const_), DOC(dai, EncodedFrame, getTimestampDevice)) .def("getSequenceNum", &EncodedFrame::getSequenceNum, DOC(dai, EncodedFrame, getSequenceNum)) - .def("getWidth", &EncodedFrame::getWidth, DOC(dai, EncodedFrame, getWidth)) - .def("getHeight", &EncodedFrame::getHeight, DOC(dai, EncodedFrame, getHeight)) .def("getQuality", &EncodedFrame::getQuality, DOC(dai, EncodedFrame, getQuality)) .def("getFrameType", &EncodedFrame::getFrameType, DOC(dai, EncodedFrame, getFrameType)) .def("getLossless", &EncodedFrame::getLossless, DOC(dai, EncodedFrame, getLossless)) @@ -97,10 +93,6 @@ void bind_encodedframe(pybind11::module& m, void* pCallstack){ .def("setTimestamp", &EncodedFrame::setTimestamp, DOC(dai, EncodedFrame, setTimestamp)) .def("setTimestampDevice", &EncodedFrame::setTimestampDevice, DOC(dai, EncodedFrame, setTimestampDevice)) .def("setSequenceNum", &EncodedFrame::setSequenceNum, DOC(dai, EncodedFrame, getSequenceNum)) - .def("setWidth", &EncodedFrame::setWidth, DOC(dai, EncodedFrame, getWidth)) - .def("setHeight", &EncodedFrame::setHeight, DOC(dai, EncodedFrame, getHeight)) - .def("setSize", static_cast(&EncodedFrame::setSize), py::arg("width"), py::arg("height"), DOC(dai, EncodedFrame, setSize)) - .def("setSize", static_cast)>(&EncodedFrame::setSize), py::arg("size"), DOC(dai, EncodedFrame, setSize, 2)) .def("setQuality", &EncodedFrame::setQuality, DOC(dai, EncodedFrame, getQuality)) .def("setFrameType", &EncodedFrame::setFrameType, DOC(dai, EncodedFrame, getFrameType)) .def("setLossless", &EncodedFrame::setLossless, DOC(dai, EncodedFrame, getLossless)) From cd7eb6c2a8778bb6b073642db39952fbeddc79e8 Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 20 Sep 2023 12:36:49 +0200 Subject: [PATCH 011/105] Added bitrate to bindings --- depthai-core | 2 +- src/pipeline/datatype/EncodedFrameBindings.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 60c0b299c..fd35a887a 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 60c0b299c010edf27ae0ee88bc07d4e35517b02d +Subproject commit fd35a887a940adde624af7114f2887f78e7010a1 diff --git a/src/pipeline/datatype/EncodedFrameBindings.cpp b/src/pipeline/datatype/EncodedFrameBindings.cpp index 80fdc22ca..41424337a 100644 --- a/src/pipeline/datatype/EncodedFrameBindings.cpp +++ b/src/pipeline/datatype/EncodedFrameBindings.cpp @@ -37,6 +37,7 @@ void bind_encodedframe(pybind11::module& m, void* pCallstack){ rawEncodedFrame .def(py::init<>()) .def_readwrite("quality", &RawEncodedFrame::quality) + .def_readwrite("bitrate", &RawEncodedFrame::bitrate) .def_readwrite("profile", &RawEncodedFrame::profile) .def_readwrite("lossless", &RawEncodedFrame::lossless) .def_readwrite("type", &RawEncodedFrame::type) @@ -85,6 +86,7 @@ void bind_encodedframe(pybind11::module& m, void* pCallstack){ .def("getTimestampDevice", py::overload_cast<>(&EncodedFrame::getTimestampDevice, py::const_), DOC(dai, EncodedFrame, getTimestampDevice)) .def("getSequenceNum", &EncodedFrame::getSequenceNum, DOC(dai, EncodedFrame, getSequenceNum)) .def("getQuality", &EncodedFrame::getQuality, DOC(dai, EncodedFrame, getQuality)) + .def("getBitrate", &EncodedFrame::getBitrate, DOC(dai, EncodedFrame, getBitrate)) .def("getFrameType", &EncodedFrame::getFrameType, DOC(dai, EncodedFrame, getFrameType)) .def("getLossless", &EncodedFrame::getLossless, DOC(dai, EncodedFrame, getLossless)) .def("getProfile", &EncodedFrame::getProfile, DOC(dai, EncodedFrame, getProfile)) @@ -94,6 +96,7 @@ void bind_encodedframe(pybind11::module& m, void* pCallstack){ .def("setTimestampDevice", &EncodedFrame::setTimestampDevice, DOC(dai, EncodedFrame, setTimestampDevice)) .def("setSequenceNum", &EncodedFrame::setSequenceNum, DOC(dai, EncodedFrame, getSequenceNum)) .def("setQuality", &EncodedFrame::setQuality, DOC(dai, EncodedFrame, getQuality)) + .def("setBitrate", &EncodedFrame::setBitrate, DOC(dai, EncodedFrame, getBitrate)) .def("setFrameType", &EncodedFrame::setFrameType, DOC(dai, EncodedFrame, getFrameType)) .def("setLossless", &EncodedFrame::setLossless, DOC(dai, EncodedFrame, getLossless)) .def("setProfile", &EncodedFrame::setProfile, DOC(dai, EncodedFrame, getProfile)) From 80fdedfacc2bf0e7c1568bd8c8f3fdb881438683 Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 21 Sep 2023 08:18:11 +0200 Subject: [PATCH 012/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index fd35a887a..acb82a5f9 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit fd35a887a940adde624af7114f2887f78e7010a1 +Subproject commit acb82a5f9ab2717f4e262e72d2907c3a66627db9 From 3aedd8fe8200831701d41405178ba32d2b679c59 Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 21 Sep 2023 08:19:56 +0200 Subject: [PATCH 013/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index acb82a5f9..f4e89f561 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit acb82a5f9ab2717f4e262e72d2907c3a66627db9 +Subproject commit f4e89f561170d48573d1834b3484377aecd1cf41 From 635ea06a3d98c58d7ab7a10b073f60d799c636eb Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 21 Sep 2023 08:29:59 +0200 Subject: [PATCH 014/105] Bump core again --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index f4e89f561..4a9ee8d0b 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit f4e89f561170d48573d1834b3484377aecd1cf41 +Subproject commit 4a9ee8d0b72fcc422b08dc00e876b49cfb851d62 From cfad98f7ac33912687fdcbbea279c28530cf6783 Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 9 Oct 2023 13:51:16 +0200 Subject: [PATCH 015/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index bcd7a0e25..810647ed7 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit bcd7a0e258a264f93ad249acf248bbc8ee617746 +Subproject commit 810647ed7464c033f79eb1fad692fbb72a5052a9 From ba9497a4210b14e6495ebb173184264ad7ceff4c Mon Sep 17 00:00:00 2001 From: alex-luxonis Date: Mon, 9 Oct 2023 18:50:41 +0300 Subject: [PATCH 016/105] FW: OAK-D-SR-PoE R1 fixes for fsync detect and status LED (green when running), StereoDepth fix for RGB-depth alignment with Left-Right-RGB layout --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index bcd7a0e25..f59efaaed 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit bcd7a0e258a264f93ad249acf248bbc8ee617746 +Subproject commit f59efaaed8c5cf20d8314e5cacb1877ce616ab7c From 40e2c12fbf270a8798c4ff63f45f08958fcc4cc1 Mon Sep 17 00:00:00 2001 From: asahtik Date: Tue, 10 Oct 2023 16:37:34 +0200 Subject: [PATCH 017/105] Added fields to encodedframe --- depthai-core | 2 +- .../datatype/EncodedFrameBindings.cpp | 202 ++++++++++-------- 2 files changed, 116 insertions(+), 88 deletions(-) diff --git a/depthai-core b/depthai-core index 16b4d98c7..4338f139b 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 16b4d98c7fc4cf70502a8862dda0202df4096506 +Subproject commit 4338f139be96e238a09f3c7fedbb7fe25e589812 diff --git a/src/pipeline/datatype/EncodedFrameBindings.cpp b/src/pipeline/datatype/EncodedFrameBindings.cpp index 41424337a..ed5018c3c 100644 --- a/src/pipeline/datatype/EncodedFrameBindings.cpp +++ b/src/pipeline/datatype/EncodedFrameBindings.cpp @@ -1,107 +1,135 @@ #include "DatatypeBindings.hpp" +#include "depthai-shared/datatype/RawEncodedFrame.hpp" #include "pipeline/CommonBindings.hpp" -#include #include +#include // depthai #include "depthai/pipeline/datatype/EncodedFrame.hpp" -//pybind +// pybind #include #include -void bind_encodedframe(pybind11::module& m, void* pCallstack){ - - using namespace dai; +void bind_encodedframe(pybind11::module &m, void *pCallstack) { - py::class_> rawEncodedFrame(m, "RawEncodedFrame", DOC(dai, RawEncodedFrame)); - py::enum_ rawEncodedFrameProfile(rawEncodedFrame, "Profile"); - py::enum_ rawEncodedFrameType(rawEncodedFrame, "FrameType", DOC(dai, RawEncodedFrame, FrameType)); - py::class_> encodedFrame(m, "EncodedFrame", DOC(dai, EncodedFrame)); + using namespace dai; - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - // Call the rest of the type defines, then perform the actual bindings - Callstack* callstack = (Callstack*) pCallstack; - auto cb = callstack->top(); - callstack->pop(); - cb(m, pCallstack); - // Actual bindings - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// + py::class_> + rawEncodedFrame(m, "RawEncodedFrame", DOC(dai, RawEncodedFrame)); + py::enum_ rawEncodedFrameProfile(rawEncodedFrame, + "Profile"); + py::enum_ rawEncodedFrameType( + rawEncodedFrame, "FrameType", DOC(dai, RawEncodedFrame, FrameType)); + py::class_> encodedFrame( + m, "EncodedFrame", DOC(dai, EncodedFrame)); - // Metadata / raw + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + // Call the rest of the type defines, then perform the actual bindings + Callstack *callstack = (Callstack *)pCallstack; + auto cb = callstack->top(); + callstack->pop(); + cb(m, pCallstack); + // Actual bindings + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// - rawEncodedFrame - .def(py::init<>()) - .def_readwrite("quality", &RawEncodedFrame::quality) - .def_readwrite("bitrate", &RawEncodedFrame::bitrate) - .def_readwrite("profile", &RawEncodedFrame::profile) - .def_readwrite("lossless", &RawEncodedFrame::lossless) - .def_readwrite("type", &RawEncodedFrame::type) - .def_readwrite("sequenceNum", &RawEncodedFrame::sequenceNum) - .def_property("ts", - [](const RawEncodedFrame& o){ - double ts = o.ts.sec + o.ts.nsec / 1000000000.0; - return ts; - }, - [](RawEncodedFrame& o, double ts){ - o.ts.sec = ts; - o.ts.nsec = (ts - o.ts.sec) * 1000000000.0; - } - ) - .def_property("tsDevice", - [](const RawEncodedFrame& o){ - double ts = o.tsDevice.sec + o.tsDevice.nsec / 1000000000.0; - return ts; - }, - [](RawEncodedFrame& o, double ts){ - o.tsDevice.sec = ts; - o.tsDevice.nsec = (ts - o.tsDevice.sec) * 1000000000.0; - } - ) - ; + // Metadata / raw + rawEncodedFrame.def(py::init<>()) + .def_readwrite("quality", &RawEncodedFrame::quality) + .def_readwrite("bitrate", &RawEncodedFrame::bitrate) + .def_readwrite("profile", &RawEncodedFrame::profile) + .def_readwrite("lossless", &RawEncodedFrame::lossless) + .def_readwrite("type", &RawEncodedFrame::type) + .def_readwrite("instanceNum", &RawEncodedFrame::instanceNum) + .def_readwrite("sequenceNum", &RawEncodedFrame::sequenceNum) + .def_property( + "ts", + [](const RawEncodedFrame &o) { + double ts = o.ts.sec + o.ts.nsec / 1000000000.0; + return ts; + }, + [](RawEncodedFrame &o, double ts) { + o.ts.sec = ts; + o.ts.nsec = (ts - o.ts.sec) * 1000000000.0; + }) + .def_property( + "tsDevice", + [](const RawEncodedFrame &o) { + double ts = o.tsDevice.sec + o.tsDevice.nsec / 1000000000.0; + return ts; + }, + [](RawEncodedFrame &o, double ts) { + o.tsDevice.sec = ts; + o.tsDevice.nsec = (ts - o.tsDevice.sec) * 1000000000.0; + }); - rawEncodedFrameProfile - .value("JPEG", EncodedFrame::Profile::JPEG) - .value("AVC", EncodedFrame::Profile::AVC) - .value("HEVC", EncodedFrame::Profile::HEVC) - ; + rawEncodedFrameProfile.value("JPEG", EncodedFrame::Profile::JPEG) + .value("AVC", EncodedFrame::Profile::AVC) + .value("HEVC", EncodedFrame::Profile::HEVC); - rawEncodedFrameType - .value("I", EncodedFrame::FrameType::I) - .value("P", EncodedFrame::FrameType::P) - .value("B", EncodedFrame::FrameType::B) - .value("Unknown", EncodedFrame::FrameType::Unknown) - ; + rawEncodedFrameType.value("I", EncodedFrame::FrameType::I) + .value("P", EncodedFrame::FrameType::P) + .value("B", EncodedFrame::FrameType::B) + .value("Unknown", EncodedFrame::FrameType::Unknown); - // Message - encodedFrame - .def(py::init<>()) - // getters - .def("getTimestamp", py::overload_cast<>(&EncodedFrame::getTimestamp, py::const_), DOC(dai, EncodedFrame, getTimestamp)) - .def("getTimestampDevice", py::overload_cast<>(&EncodedFrame::getTimestampDevice, py::const_), DOC(dai, EncodedFrame, getTimestampDevice)) - .def("getSequenceNum", &EncodedFrame::getSequenceNum, DOC(dai, EncodedFrame, getSequenceNum)) - .def("getQuality", &EncodedFrame::getQuality, DOC(dai, EncodedFrame, getQuality)) - .def("getBitrate", &EncodedFrame::getBitrate, DOC(dai, EncodedFrame, getBitrate)) - .def("getFrameType", &EncodedFrame::getFrameType, DOC(dai, EncodedFrame, getFrameType)) - .def("getLossless", &EncodedFrame::getLossless, DOC(dai, EncodedFrame, getLossless)) - .def("getProfile", &EncodedFrame::getProfile, DOC(dai, EncodedFrame, getProfile)) + // Message + encodedFrame + .def(py::init<>()) + // getters + .def("getTimestamp", + py::overload_cast<>(&EncodedFrame::getTimestamp, py::const_), + DOC(dai, EncodedFrame, getTimestamp)) + .def("getTimestampDevice", + py::overload_cast<>(&EncodedFrame::getTimestampDevice, py::const_), + DOC(dai, EncodedFrame, getTimestampDevice)) + .def("getInstanceNum", &EncodedFrame::getInstanceNum, + DOC(dai, EncodedFrame, getInstanceNum)) + .def("getSequenceNum", &EncodedFrame::getSequenceNum, + DOC(dai, EncodedFrame, getSequenceNum)) + .def("getExposureTime", &EncodedFrame::getExposureTime, + DOC(dai, EncodedFrame, getExposureTime)) + .def("getSensitivity", &EncodedFrame::getSensitivity, + DOC(dai, EncodedFrame, getSensitivity)) + .def("getColorTemperature", &EncodedFrame::getColorTemperature, + DOC(dai, EncodedFrame, getColorTemperature)) + .def("getLensPosition", &EncodedFrame::getLensPosition, + DOC(dai, EncodedFrame, getLensPosition)) + .def("getQuality", &EncodedFrame::getQuality, + DOC(dai, EncodedFrame, getQuality)) + .def("getBitrate", &EncodedFrame::getBitrate, + DOC(dai, EncodedFrame, getBitrate)) + .def("getFrameType", &EncodedFrame::getFrameType, + DOC(dai, EncodedFrame, getFrameType)) + .def("getLossless", &EncodedFrame::getLossless, + DOC(dai, EncodedFrame, getLossless)) + .def("getProfile", &EncodedFrame::getProfile, + DOC(dai, EncodedFrame, getProfile)) - // setters - .def("setTimestamp", &EncodedFrame::setTimestamp, DOC(dai, EncodedFrame, setTimestamp)) - .def("setTimestampDevice", &EncodedFrame::setTimestampDevice, DOC(dai, EncodedFrame, setTimestampDevice)) - .def("setSequenceNum", &EncodedFrame::setSequenceNum, DOC(dai, EncodedFrame, getSequenceNum)) - .def("setQuality", &EncodedFrame::setQuality, DOC(dai, EncodedFrame, getQuality)) - .def("setBitrate", &EncodedFrame::setBitrate, DOC(dai, EncodedFrame, getBitrate)) - .def("setFrameType", &EncodedFrame::setFrameType, DOC(dai, EncodedFrame, getFrameType)) - .def("setLossless", &EncodedFrame::setLossless, DOC(dai, EncodedFrame, getLossless)) - .def("setProfile", &EncodedFrame::setProfile, DOC(dai, EncodedFrame, getProfile)) - ; - // add aliases dai.ImgFrame.Type and dai.ImgFrame.Specs - m.attr("EncodedFrame").attr("FrameType") = m.attr("RawEncodedFrame").attr("FrameType"); - m.attr("EncodedFrame").attr("Profile") = m.attr("RawEncodedFrame").attr("Profile"); + // setters + .def("setTimestamp", &EncodedFrame::setTimestamp, + DOC(dai, EncodedFrame, setTimestamp)) + .def("setTimestampDevice", &EncodedFrame::setTimestampDevice, + DOC(dai, EncodedFrame, setTimestampDevice)) + .def("setSequenceNum", &EncodedFrame::setSequenceNum, + DOC(dai, EncodedFrame, getSequenceNum)) + .def("setQuality", &EncodedFrame::setQuality, + DOC(dai, EncodedFrame, getQuality)) + .def("setBitrate", &EncodedFrame::setBitrate, + DOC(dai, EncodedFrame, getBitrate)) + .def("setFrameType", &EncodedFrame::setFrameType, + DOC(dai, EncodedFrame, getFrameType)) + .def("setLossless", &EncodedFrame::setLossless, + DOC(dai, EncodedFrame, getLossless)) + .def("setProfile", &EncodedFrame::setProfile, + DOC(dai, EncodedFrame, getProfile)); + // add aliases dai.ImgFrame.Type and dai.ImgFrame.Specs + m.attr("EncodedFrame").attr("FrameType") = + m.attr("RawEncodedFrame").attr("FrameType"); + m.attr("EncodedFrame").attr("Profile") = + m.attr("RawEncodedFrame").attr("Profile"); } From 37c05dd161bd78a372bd660b5c1d792a04c561d4 Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 11 Oct 2023 11:03:12 +0200 Subject: [PATCH 018/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 4338f139b..797638a08 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 4338f139be96e238a09f3c7fedbb7fe25e589812 +Subproject commit 797638a0803bc846791c1b8446b1198ed086179b From 20a59d6ab421d0929c74f1a51e5f7ce66a972599 Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 18 Oct 2023 11:15:48 +0200 Subject: [PATCH 019/105] Implemented message groups and sync node --- CMakeLists.txt | 2 + depthai-core | 2 +- src/DatatypeBindings.cpp | 2 + .../datatype/MessageGroupBindings.cpp | 58 +++++++++++++++++++ src/pipeline/node/NodeBindings.cpp | 2 + src/pipeline/node/SyncBindings.cpp | 48 +++++++++++++++ 6 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 src/pipeline/datatype/MessageGroupBindings.cpp create mode 100644 src/pipeline/node/SyncBindings.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d8fc4fee8..99a909bfd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,6 +129,7 @@ pybind11_add_module(${TARGET_NAME} src/pipeline/node/WarpBindings.cpp src/pipeline/node/UVCBindings.cpp src/pipeline/node/ToFBindings.cpp + src/pipeline/node/SyncBindings.cpp src/pipeline/datatype/ADatatypeBindings.cpp src/pipeline/datatype/AprilTagConfigBindings.cpp @@ -142,6 +143,7 @@ pybind11_add_module(${TARGET_NAME} src/pipeline/datatype/ImgDetectionsBindings.cpp src/pipeline/datatype/ImgFrameBindings.cpp src/pipeline/datatype/IMUDataBindings.cpp + src/pipeline/datatype/MessageGroupBindings.cpp src/pipeline/datatype/NNDataBindings.cpp src/pipeline/datatype/SpatialImgDetectionsBindings.cpp src/pipeline/datatype/SpatialLocationCalculatorConfigBindings.cpp diff --git a/depthai-core b/depthai-core index 810647ed7..b5150b10d 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 810647ed7464c033f79eb1fad692fbb72a5052a9 +Subproject commit b5150b10d1121b4e8a01c5e54b05e7c4d32934a7 diff --git a/src/DatatypeBindings.cpp b/src/DatatypeBindings.cpp index 5ff683f3d..4c4a9bb8a 100644 --- a/src/DatatypeBindings.cpp +++ b/src/DatatypeBindings.cpp @@ -14,6 +14,7 @@ void bind_imagemanipconfig(pybind11::module& m, void* pCallstack); void bind_imgdetections(pybind11::module& m, void* pCallstack); void bind_imgframe(pybind11::module& m, void* pCallstack); void bind_imudata(pybind11::module& m, void* pCallstack); +void bind_message_group(pybind11::module& m, void* pCallstack); void bind_nndata(pybind11::module& m, void* pCallstack); void bind_spatialimgdetections(pybind11::module& m, void* pCallstack); void bind_spatiallocationcalculatorconfig(pybind11::module& m, void* pCallstack); @@ -40,6 +41,7 @@ void DatatypeBindings::addToCallstack(std::deque& callstack) { callstack.push_front(bind_imgdetections); callstack.push_front(bind_imgframe); callstack.push_front(bind_imudata); + callstack.push_front(bind_message_group); callstack.push_front(bind_nndata); callstack.push_front(bind_spatialimgdetections); callstack.push_front(bind_spatiallocationcalculatorconfig); diff --git a/src/pipeline/datatype/MessageGroupBindings.cpp b/src/pipeline/datatype/MessageGroupBindings.cpp new file mode 100644 index 000000000..c1a859e31 --- /dev/null +++ b/src/pipeline/datatype/MessageGroupBindings.cpp @@ -0,0 +1,58 @@ +#include "DatatypeBindings.hpp" +#include "depthai-shared/datatype/RawMessageGroup.hpp" +#include "pipeline/CommonBindings.hpp" +#include +#include + +// depthai +#include "depthai/pipeline/datatype/MessageGroup.hpp" + +//pybind +#include +#include + +// #include "spdlog/spdlog.h" + +void bind_message_group(pybind11::module& m, void* pCallstack){ + + using namespace dai; + + py::class_> rawMessageGroup(m, "RawMessageGroup", DOC(dai, RawMessageGroup)); + py::class_> messageGroup(m, "MessageGroup", DOC(dai, MessageGroup)); + + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + // Call the rest of the type defines, then perform the actual bindings + Callstack* callstack = (Callstack*) pCallstack; + auto cb = callstack->top(); + callstack->pop(); + cb(m, pCallstack); + // Actual bindings + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + + // Metadata / raw + rawMessageGroup + .def(py::init<>()) + .def_readwrite("group", &RawMessageGroup::group) + .def_readwrite("success", &RawMessageGroup::success) + ; + + // Message + messageGroup + .def(py::init<>()) + .def("__getitem__", [](MessageGroup& msg, const std::string& name) { + return msg[name]; + }) + .def("syncSuccessful", &MessageGroup::syncSuccessful, DOC(dai, MessageGroup, syncSuccessful)) + .def("getTimestamp", &MessageGroup::Buffer::getTimestamp, DOC(dai, Buffer, getTimestamp)) + .def("getTimestampDevice", &MessageGroup::Buffer::getTimestampDevice, DOC(dai, Buffer, getTimestampDevice)) + .def("getSequenceNum", &MessageGroup::Buffer::getSequenceNum, DOC(dai, Buffer, getSequenceNum)) + .def("setTimestamp", &MessageGroup::setTimestamp, DOC(dai, MessageGroup, setTimestamp)) + .def("setTimestampDevice", &MessageGroup::setTimestampDevice, DOC(dai, MessageGroup, setTimestampDevice)) + .def("setSequenceNum", &MessageGroup::setSequenceNum, DOC(dai, MessageGroup, setSequenceNum)) + ; + +} diff --git a/src/pipeline/node/NodeBindings.cpp b/src/pipeline/node/NodeBindings.cpp index 06e790377..5b94a435f 100644 --- a/src/pipeline/node/NodeBindings.cpp +++ b/src/pipeline/node/NodeBindings.cpp @@ -116,6 +116,7 @@ void bind_apriltag(pybind11::module& m, void* pCallstack); void bind_detectionparser(pybind11::module& m, void* pCallstack); void bind_uvc(pybind11::module& m, void* pCallstack); void bind_tof(pybind11::module& m, void* pCallstack); +void bind_sync(pybind11::module& m, void* pCallstack); void NodeBindings::addToCallstack(std::deque& callstack) { // Bind Node et al @@ -147,6 +148,7 @@ void NodeBindings::addToCallstack(std::deque& callstack) { callstack.push_front(bind_detectionparser); callstack.push_front(bind_uvc); callstack.push_front(bind_tof); + callstack.push_front(bind_sync); } void NodeBindings::bind(pybind11::module& m, void* pCallstack){ diff --git a/src/pipeline/node/SyncBindings.cpp b/src/pipeline/node/SyncBindings.cpp new file mode 100644 index 000000000..fc7a8e8d4 --- /dev/null +++ b/src/pipeline/node/SyncBindings.cpp @@ -0,0 +1,48 @@ +#include "NodeBindings.hpp" +#include "Common.hpp" + +#include "depthai-shared/properties/SyncProperties.hpp" +#include "depthai/pipeline/Pipeline.hpp" +#include "depthai/pipeline/Node.hpp" +#include "depthai/pipeline/node/Sync.hpp" + +void bind_sync(pybind11::module& m, void* pCallstack){ + + using namespace dai; + using namespace dai::node; + + // Node and Properties declare upfront + py::class_ syncProperties(m, "SyncProperties", DOC(dai, SyncProperties)); + auto sync = ADD_NODE(Sync); + + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + // Call the rest of the type defines, then perform the actual bindings + Callstack* callstack = (Callstack*) pCallstack; + auto cb = callstack->top(); + callstack->pop(); + cb(m, pCallstack); + // Actual bindings + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + + // Properties + syncProperties + .def_readwrite("syncIntervalMs", &SyncProperties::syncIntervalMs) + .def_readwrite("syncAttempts", &SyncProperties::syncAttempts) + ; + + // Node + sync + .def_readonly("out", &Sync::out, DOC(dai, node, Sync, out)) + .def_readonly("inputs", &Sync::inputs, DOC(dai, node, Sync, inputs)) + .def("setSyncIntervalMs", &Sync::setSyncIntervalMs, py::arg("syncInterval"), DOC(dai, node, Sync, setSyncInterval)) + .def("setSyncAttempts", &Sync::setSyncAttempts, py::arg("maxDataSize"), DOC(dai, node, Sync, setSyncAttempts)) + .def("getSyncIntervalMs", &Sync::getSyncIntervalMs, DOC(dai, node, Sync, getSyncIntervalMs)) + .def("getSyncAttempts", &Sync::getSyncAttempts, DOC(dai, node, Sync, getSyncAttempts)) + ; + daiNodeModule.attr("Sync").attr("Properties") = syncProperties; + +} From ed3dc76d83309d7a3c3350ddce6a71b508ded1b4 Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Wed, 18 Oct 2023 22:37:07 +0200 Subject: [PATCH 020/105] Add more options to the stereo_from_host_example --- examples/StereoDepth/stereo_depth_from_host.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/examples/StereoDepth/stereo_depth_from_host.py b/examples/StereoDepth/stereo_depth_from_host.py index 08f4c06b8..971886678 100755 --- a/examples/StereoDepth/stereo_depth_from_host.py +++ b/examples/StereoDepth/stereo_depth_from_host.py @@ -17,6 +17,9 @@ parser.add_argument("-e", "--evaluate", help="Evaluate the disparity calculation.", default=None) parser.add_argument("-dumpdispcost", "--dumpdisparitycostvalues", action="store_true", help="Dumps the disparity cost values for each disparity range. 96 byte for each pixel.") parser.add_argument("--download", action="store_true", help="Downloads the 2014 Middlebury dataset.") +parser.add_argument("--calibration", help="Path to calibration file", default=None) +parser.add_argument("--rectify", action="store_true", help="Enable rectified streams") +parser.add_argument("--swapLR", action="store_true", help="Swap left and right cameras.") args = parser.parse_args() if args.evaluate is not None and args.dataset is not None: @@ -603,8 +606,12 @@ def __init__(self, config): stereo.setRuntimeModeSwitch(True) # Linking -monoLeft.out.link(stereo.left) -monoRight.out.link(stereo.right) +if(args.swapLR): + monoLeft.out.link(stereo.right) + monoRight.out.link(stereo.left) +else: + monoLeft.out.link(stereo.left) + monoRight.out.link(stereo.right) xinStereoDepthConfig.out.link(stereo.inputConfig) stereo.syncedLeft.link(xoutLeft.input) stereo.syncedRight.link(xoutRight.input) @@ -630,9 +637,11 @@ def __init__(self, config): StereoConfigHandler.registerWindow("Stereo control panel") # stereo.setPostProcessingHardwareResources(3, 3) - +if(args.calibration): + calibrationHandler = dai.CalibrationHandler(args.calibration) + pipeline.setCalibrationData(calibrationHandler) stereo.setInputResolution(width, height) -stereo.setRectification(False) +stereo.setRectification(args.rectify) baseline = 75 fov = 71.86 focal = width / (2 * math.tan(fov / 2 / 180 * math.pi)) From 43f20e6b7847276a12c69ddcd63984bcfaa69e74 Mon Sep 17 00:00:00 2001 From: alex-luxonis Date: Mon, 23 Oct 2023 15:56:52 +0300 Subject: [PATCH 021/105] CameraControl: add `setControlMode`, `setCaptureIntent` --- depthai-core | 2 +- .../datatype/CameraControlBindings.cpp | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index f59efaaed..585809142 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit f59efaaed8c5cf20d8314e5cacb1877ce616ab7c +Subproject commit 58580914271b181d7189c9172d389e6fe8d77f34 diff --git a/src/pipeline/datatype/CameraControlBindings.cpp b/src/pipeline/datatype/CameraControlBindings.cpp index 06ebb4ab4..7ebdeead8 100644 --- a/src/pipeline/datatype/CameraControlBindings.cpp +++ b/src/pipeline/datatype/CameraControlBindings.cpp @@ -21,6 +21,8 @@ void bind_cameracontrol(pybind11::module& m, void* pCallstack){ py::enum_ rawCameraControlAutoFocusMode(rawCameraControl, "AutoFocusMode", DOC(dai, RawCameraControl, AutoFocusMode)); py::enum_ rawCameraControlAutoWhiteBalanceMode(rawCameraControl, "AutoWhiteBalanceMode", DOC(dai, RawCameraControl, AutoWhiteBalanceMode)); py::enum_ rawCameraControlSceneMode(rawCameraControl, "SceneMode", DOC(dai, RawCameraControl, SceneMode)); + py::enum_ rawCameraControlControlMode(rawCameraControl, "ControlMode", DOC(dai, RawCameraControl, ControlMode)); + py::enum_ rawCameraControlCaptureIntent(rawCameraControl, "CaptureIntent", DOC(dai, RawCameraControl, CaptureIntent)); py::enum_ rawCameraControlAntiBandingMode(rawCameraControl, "AntiBandingMode", DOC(dai, RawCameraControl, AntiBandingMode)); py::enum_ rawCameraControlEffectMode(rawCameraControl, "EffectMode", DOC(dai, RawCameraControl, EffectMode)); py::enum_ rawCameraControlFrameSyncMode(rawCameraControl, "FrameSyncMode", DOC(dai, RawCameraControl, FrameSyncMode)); @@ -125,6 +127,23 @@ std::vector camCtrlAttr; .value("BARCODE", RawCameraControl::SceneMode::BARCODE) ; + camCtrlAttr.push_back("ControlMode"); + rawCameraControlControlMode + .value("OFF", RawCameraControl::ControlMode::OFF) + .value("AUTO", RawCameraControl::ControlMode::AUTO) + .value("USE_SCENE_MODE", RawCameraControl::ControlMode::USE_SCENE_MODE) + ; + + camCtrlAttr.push_back("CaptureIntent"); + rawCameraControlCaptureIntent + .value("CUSTOM", RawCameraControl::CaptureIntent::CUSTOM) + .value("PREVIEW", RawCameraControl::CaptureIntent::PREVIEW) + .value("STILL_CAPTURE", RawCameraControl::CaptureIntent::STILL_CAPTURE) + .value("VIDEO_RECORD", RawCameraControl::CaptureIntent::VIDEO_RECORD) + .value("VIDEO_SNAPSHOT", RawCameraControl::CaptureIntent::VIDEO_SNAPSHOT) + .value("ZERO_SHUTTER_LAG", RawCameraControl::CaptureIntent::ZERO_SHUTTER_LAG) + ; + camCtrlAttr.push_back("AntiBandingMode"); rawCameraControlAntiBandingMode .value("OFF", RawCameraControl::AntiBandingMode::OFF) @@ -163,6 +182,8 @@ std::vector camCtrlAttr; .def_readwrite("awbMode", &RawCameraControl::awbMode) .def_readwrite("sceneMode", &RawCameraControl::sceneMode) .def_readwrite("antiBandingMode", &RawCameraControl::antiBandingMode) + .def_readwrite("captureIntent", &RawCameraControl::captureIntent) + .def_readwrite("controlMode", &RawCameraControl::controlMode) .def_readwrite("effectMode", &RawCameraControl::effectMode) .def_readwrite("aeLockMode", &RawCameraControl::aeLockMode) .def_readwrite("awbLockMode", &RawCameraControl::awbLockMode) @@ -214,6 +235,8 @@ std::vector camCtrlAttr; .def("setChromaDenoise", &CameraControl::setChromaDenoise, py::arg("value"), DOC(dai, CameraControl, setChromaDenoise)) .def("setSceneMode", &CameraControl::setSceneMode, py::arg("mode"), DOC(dai, CameraControl, setSceneMode)) .def("setEffectMode", &CameraControl::setEffectMode, py::arg("mode"), DOC(dai, CameraControl, setEffectMode)) + .def("setControlMode", &CameraControl::setControlMode, py::arg("mode"), DOC(dai, CameraControl, setControlMode)) + .def("setCaptureIntent", &CameraControl::setCaptureIntent, py::arg("mode"), DOC(dai, CameraControl, setCaptureIntent)) .def("set", &CameraControl::set, py::arg("config"), DOC(dai, CameraControl, set)) // getters .def("getCaptureStill", &CameraControl::getCaptureStill, DOC(dai, CameraControl, getCaptureStill)) From aba784eae3339be2a2999eafbe19c4aa7a009d33 Mon Sep 17 00:00:00 2001 From: alex-luxonis Date: Mon, 23 Oct 2023 16:21:41 +0300 Subject: [PATCH 022/105] cam_test.py: add scene mode, control mode, capture intent (`\` `;` `'` keys), add `-show`/`--show-meta` for starting with ImgFrame camera settings prints enabled, fix cycling back and forth between enum-type elements, capture file name: move date_time before camera parameters (for ordering), capture file name: add color temperature (like _4500K), dot/flood controls: print value set --- utilities/cam_test.py | 72 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 14 deletions(-) diff --git a/utilities/cam_test.py b/utilities/cam_test.py index eabd9cfb5..aaa55f882 100755 --- a/utilities/cam_test.py +++ b/utilities/cam_test.py @@ -24,6 +24,9 @@ '0' - Select control: sharpness '[' - Select control: luma denoise ']' - Select control: chroma denoise +'\' - Select control: scene mode +';' - Select control: control mode +''' - Select control: capture intent 'a' 'd' - Increase/decrease dot projector intensity 'w' 's' - Increase/decrease flood LED intensity @@ -93,6 +96,8 @@ def socket_type_pair(arg): help="ToF median filter kernel size") parser.add_argument('-rgbprev', '--rgb-preview', action='store_true', help="Show RGB `preview` stream instead of full size `isp`") +parser.add_argument('-show', '--show-meta', action='store_true', + help="List frame metadata (seqno, timestamp, exp, iso etc). Can also toggle with `\`") parser.add_argument('-d', '--device', default="", type=str, help="Optional MX ID of the device to connect to.") @@ -189,6 +194,22 @@ def update(self, timestamp=None): def get(self): return self.fps +class Cycle: + def __init__(self, enum_type, start_item=None): + self.items = [item for name, item in vars(enum_type).items() if name.isupper()] + # If start_item is provided, set the index to its position. Otherwise, default to 0 + self.index = self.items.index(start_item) if start_item else 0 + + def step(self, n): + self.index = (self.index + n) % len(self.items) + return self.items[self.index] + + def next(self): + return self.step(1) + + def prev(self): + return self.step(-1) + # Start defining a pipeline pipeline = dai.Pipeline() # Uncomment to get better throughput @@ -354,12 +375,12 @@ def exit_cleanly(signum, frame): dotIntensity = 0 floodIntensity = 0 - awb_mode = cycle([item for name, item in vars( - dai.CameraControl.AutoWhiteBalanceMode).items() if name.isupper()]) - anti_banding_mode = cycle([item for name, item in vars( - dai.CameraControl.AntiBandingMode).items() if name.isupper()]) - effect_mode = cycle([item for name, item in vars( - dai.CameraControl.EffectMode).items() if name.isupper()]) + awb_mode = Cycle(dai.CameraControl.AutoWhiteBalanceMode) + anti_banding_mode = Cycle(dai.CameraControl.AntiBandingMode) + effect_mode = Cycle(dai.CameraControl.EffectMode) + scene_mode = Cycle(dai.CameraControl.SceneMode) + control_mode = Cycle(dai.CameraControl.ControlMode) + capture_intent = Cycle(dai.CameraControl.CaptureIntent) ae_comp = 0 ae_lock = False @@ -371,7 +392,7 @@ def exit_cleanly(signum, frame): luma_denoise = 0 chroma_denoise = 0 control = 'none' - show = False + show = args.show_meta jet_custom = cv2.applyColorMap(np.arange(256, dtype=np.uint8), cv2.COLORMAP_JET) jet_custom[0] = [0, 0, 0] @@ -402,7 +423,7 @@ def exit_cleanly(signum, frame): frame = cv2.normalize(frame, frame, alpha=255, beta=0, norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_8U) frame = cv2.applyColorMap(frame, jet_custom) if show: - txt = f"[{c:5}, {pkt.getSequenceNum():4}] " + txt = f"[{c:5}, {pkt.getSequenceNum():4}, {pkt.getTimestamp().total_seconds():.6f}] " txt += f"Exp: {pkt.getExposureTime().total_seconds()*1000:6.3f} ms, " txt += f"ISO: {pkt.getSensitivity():4}, " txt += f"Lens pos: {pkt.getLensPosition():3}, " @@ -415,10 +436,11 @@ def exit_cleanly(signum, frame): if capture: capture_file_info = ('capture_' + c + '_' + cam_name[cam_socket_opts[cam_skt].name] + '_' + str(width) + 'x' + str(height) + + '_' + capture_time + '_exp_' + str(int(pkt.getExposureTime().total_seconds()*1e6)) + '_iso_' + str(pkt.getSensitivity()) + '_lens_' + str(pkt.getLensPosition()) - + '_' + capture_time + + '_' + str(pkt.getColorTemperature()) + 'K' + '_' + str(pkt.getSequenceNum()) ) capture_list.remove(c) @@ -535,22 +557,26 @@ def exit_cleanly(signum, frame): if dotIntensity < 0: dotIntensity = 0 device.setIrLaserDotProjectorBrightness(dotIntensity) + print(f'IR Dot intensity:', dotIntensity) elif key == ord('d'): dotIntensity = dotIntensity + DOT_STEP if dotIntensity > DOT_MAX: dotIntensity = DOT_MAX device.setIrLaserDotProjectorBrightness(dotIntensity) + print(f'IR Dot intensity:', dotIntensity) elif key == ord('w'): floodIntensity = floodIntensity + FLOOD_STEP if floodIntensity > FLOOD_MAX: floodIntensity = FLOOD_MAX device.setIrFloodLightBrightness(floodIntensity) + print(f'IR Flood intensity:', floodIntensity) elif key == ord('s'): floodIntensity = floodIntensity - FLOOD_STEP if floodIntensity < 0: floodIntensity = 0 device.setIrFloodLightBrightness(floodIntensity) - elif key >= 0 and chr(key) in '34567890[]p': + print(f'IR Flood intensity:', floodIntensity) + elif key >= 0 and chr(key) in '34567890[]p\\;\'': if key == ord('3'): control = 'awb_mode' elif key == ord('4'): @@ -567,6 +593,12 @@ def exit_cleanly(signum, frame): control = 'saturation' elif key == ord('0'): control = 'sharpness' + elif key == ord('\\'): + control = 'scene_mode' + elif key == ord(';'): + control = 'control_mode' + elif key == ord('\''): + control = 'capture_intent' elif key == ord('['): control = 'luma_denoise' elif key == ord(']'): @@ -582,23 +614,35 @@ def exit_cleanly(signum, frame): change = 1 ctrl = dai.CameraControl() if control == 'none': - print("Please select a control first using keys 3..9 0 [ ]") + print("Please select a control first using keys 3..9 0 [ ] \\ ; \'") elif control == 'ae_comp': ae_comp = clamp(ae_comp + change, -9, 9) print("Auto exposure compensation:", ae_comp) ctrl.setAutoExposureCompensation(ae_comp) elif control == 'anti_banding_mode': - abm = next(anti_banding_mode) + abm = anti_banding_mode.step(change) print("Anti-banding mode:", abm) ctrl.setAntiBandingMode(abm) elif control == 'awb_mode': - awb = next(awb_mode) + awb = awb_mode.step(change) print("Auto white balance mode:", awb) ctrl.setAutoWhiteBalanceMode(awb) elif control == 'effect_mode': - eff = next(effect_mode) + eff = effect_mode.step(change) print("Effect mode:", eff) ctrl.setEffectMode(eff) + elif control == 'scene_mode': + sc = scene_mode.step(change) + print("Scene mode:", sc) + ctrl.setSceneMode(sc) + elif control == 'control_mode': + cm = control_mode.step(change) + print("Control mode:", cm) + ctrl.setControlMode(cm) + elif control == 'capture_intent': + ci = capture_intent.step(change) + print("Capture intent:", ci) + ctrl.setCaptureIntent(ci) elif control == 'brightness': brightness = clamp(brightness + change, -10, 10) print("Brightness:", brightness) From b177b9d709c08a924e1749147ccd585784374d23 Mon Sep 17 00:00:00 2001 From: asahtik Date: Fri, 27 Oct 2023 14:47:38 +0200 Subject: [PATCH 023/105] WIP: fix add binding somehow --- depthai-core | 2 +- src/pipeline/datatype/MessageGroupBindings.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index b5150b10d..8a37a5a6d 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit b5150b10d1121b4e8a01c5e54b05e7c4d32934a7 +Subproject commit 8a37a5a6d933adf5b393dc31887ed84564782fbd diff --git a/src/pipeline/datatype/MessageGroupBindings.cpp b/src/pipeline/datatype/MessageGroupBindings.cpp index c1a859e31..c2708b96b 100644 --- a/src/pipeline/datatype/MessageGroupBindings.cpp +++ b/src/pipeline/datatype/MessageGroupBindings.cpp @@ -46,6 +46,9 @@ void bind_message_group(pybind11::module& m, void* pCallstack){ .def("__getitem__", [](MessageGroup& msg, const std::string& name) { return msg[name]; }) + .def("__setitem__", [](MessageGroup& msg, const std::string& name, std::shared_ptr data) { + return msg.add(name, data); + }) .def("syncSuccessful", &MessageGroup::syncSuccessful, DOC(dai, MessageGroup, syncSuccessful)) .def("getTimestamp", &MessageGroup::Buffer::getTimestamp, DOC(dai, Buffer, getTimestamp)) .def("getTimestampDevice", &MessageGroup::Buffer::getTimestampDevice, DOC(dai, Buffer, getTimestampDevice)) From e5581d0c011846c71b8bc6e8999bccf65848bc72 Mon Sep 17 00:00:00 2001 From: asahtik Date: Sat, 28 Oct 2023 13:38:05 +0200 Subject: [PATCH 024/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 797638a08..d519eedd7 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 797638a0803bc846791c1b8446b1198ed086179b +Subproject commit d519eedd73492a0ad7a828e8a18c4247d16b5716 From 91d2e79623e61d327ff669724de9486246b58355 Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 30 Oct 2023 11:57:13 +0100 Subject: [PATCH 025/105] Fixed python bindings --- depthai-core | 2 +- src/pipeline/datatype/MessageGroupBindings.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index d1a1d3b7e..d22bbb552 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit d1a1d3b7e3d5765b09d284226bb53de6b35ca8c4 +Subproject commit d22bbb552c0b9160b3d50d9dc8a77d3053ddbe94 diff --git a/src/pipeline/datatype/MessageGroupBindings.cpp b/src/pipeline/datatype/MessageGroupBindings.cpp index c2708b96b..56784740c 100644 --- a/src/pipeline/datatype/MessageGroupBindings.cpp +++ b/src/pipeline/datatype/MessageGroupBindings.cpp @@ -44,6 +44,7 @@ void bind_message_group(pybind11::module& m, void* pCallstack){ messageGroup .def(py::init<>()) .def("__getitem__", [](MessageGroup& msg, const std::string& name) { + std::shared_ptr data = nullptr; return msg[name]; }) .def("__setitem__", [](MessageGroup& msg, const std::string& name, std::shared_ptr data) { From 3ae8ff9fdc525db3476cfbbe364c38784bfdbe41 Mon Sep 17 00:00:00 2001 From: alex-luxonis Date: Tue, 31 Oct 2023 22:53:24 +0200 Subject: [PATCH 026/105] FW: multiple tunings to fix image quality issues, OV9782 tuning, IMX462 fix for ISO --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 48d36694a..ecfec8249 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 48d36694afe5923859a2baa97071b33a7aab2684 +Subproject commit ecfec82494f17cd4252c47a2425c5fba51f3e882 From 11ede87db3f1ec27d6a61d07c631f034e76fc8bf Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 2 Nov 2023 11:28:55 +0100 Subject: [PATCH 027/105] Implemented messagedemux --- CMakeLists.txt | 1 + depthai-core | 2 +- src/pipeline/datatype/MessageGroupBindings.cpp | 1 + src/pipeline/node/NodeBindings.cpp | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99a909bfd..8e9663aca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,6 +130,7 @@ pybind11_add_module(${TARGET_NAME} src/pipeline/node/UVCBindings.cpp src/pipeline/node/ToFBindings.cpp src/pipeline/node/SyncBindings.cpp + src/pipeline/node/MessageDemuxBindings.cpp src/pipeline/datatype/ADatatypeBindings.cpp src/pipeline/datatype/AprilTagConfigBindings.cpp diff --git a/depthai-core b/depthai-core index d22bbb552..b65c24da0 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit d22bbb552c0b9160b3d50d9dc8a77d3053ddbe94 +Subproject commit b65c24da05b2c9c725024956ff153c5d3046343e diff --git a/src/pipeline/datatype/MessageGroupBindings.cpp b/src/pipeline/datatype/MessageGroupBindings.cpp index 56784740c..7bbf560f3 100644 --- a/src/pipeline/datatype/MessageGroupBindings.cpp +++ b/src/pipeline/datatype/MessageGroupBindings.cpp @@ -51,6 +51,7 @@ void bind_message_group(pybind11::module& m, void* pCallstack){ return msg.add(name, data); }) .def("syncSuccessful", &MessageGroup::syncSuccessful, DOC(dai, MessageGroup, syncSuccessful)) + .def("getIntervalNs", &MessageGroup::getIntervalNs, DOC(dai, MessageGroup, getIntervalNs)) .def("getTimestamp", &MessageGroup::Buffer::getTimestamp, DOC(dai, Buffer, getTimestamp)) .def("getTimestampDevice", &MessageGroup::Buffer::getTimestampDevice, DOC(dai, Buffer, getTimestampDevice)) .def("getSequenceNum", &MessageGroup::Buffer::getSequenceNum, DOC(dai, Buffer, getSequenceNum)) diff --git a/src/pipeline/node/NodeBindings.cpp b/src/pipeline/node/NodeBindings.cpp index 5b94a435f..72eb93356 100644 --- a/src/pipeline/node/NodeBindings.cpp +++ b/src/pipeline/node/NodeBindings.cpp @@ -117,6 +117,7 @@ void bind_detectionparser(pybind11::module& m, void* pCallstack); void bind_uvc(pybind11::module& m, void* pCallstack); void bind_tof(pybind11::module& m, void* pCallstack); void bind_sync(pybind11::module& m, void* pCallstack); +void bind_messagedemux(pybind11::module& m, void* pCallstack); void NodeBindings::addToCallstack(std::deque& callstack) { // Bind Node et al @@ -149,6 +150,7 @@ void NodeBindings::addToCallstack(std::deque& callstack) { callstack.push_front(bind_uvc); callstack.push_front(bind_tof); callstack.push_front(bind_sync); + callstack.push_front(bind_messagedemux); } void NodeBindings::bind(pybind11::module& m, void* pCallstack){ From 3aa11bab6f71cf2e059ef08c7da567313ec16d52 Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 2 Nov 2023 11:29:05 +0100 Subject: [PATCH 028/105] Implemented messagedemux --- src/pipeline/node/MessageDemuxBindings.cpp | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/pipeline/node/MessageDemuxBindings.cpp diff --git a/src/pipeline/node/MessageDemuxBindings.cpp b/src/pipeline/node/MessageDemuxBindings.cpp new file mode 100644 index 000000000..253830a4e --- /dev/null +++ b/src/pipeline/node/MessageDemuxBindings.cpp @@ -0,0 +1,42 @@ +#include "Common.hpp" +#include "NodeBindings.hpp" + +#include "depthai-shared/properties/MessageDemuxProperties.hpp" +#include "depthai/pipeline/Node.hpp" +#include "depthai/pipeline/Pipeline.hpp" +#include "depthai/pipeline/node/MessageDemux.hpp" + +void bind_messagedemux(pybind11::module &m, void *pCallstack) { + + using namespace dai; + using namespace dai::node; + + // Node and Properties declare upfront + py::class_ messageDemuxProperties( + m, "MessageDemuxProperties", DOC(dai, MessageDemuxProperties)); + auto messageDemux = ADD_NODE(MessageDemux); + + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + // Call the rest of the type defines, then perform the actual bindings + Callstack *callstack = (Callstack *)pCallstack; + auto cb = callstack->top(); + callstack->pop(); + cb(m, pCallstack); + // Actual bindings + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + + // Properties + + // Node + messageDemux + .def_readonly("outputs", &MessageDemux::outputs, + DOC(dai, node, MessageDemux, outputs)) + .def_readonly("input", &MessageDemux::input, + DOC(dai, node, MessageDemux, in)); + daiNodeModule.attr("MessageDemux").attr("Properties") = + messageDemuxProperties; +} From 5190fdee90087034e3e59d570b10da2ac5f7c283 Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 2 Nov 2023 17:44:50 +0100 Subject: [PATCH 029/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index ac762111f..21421309a 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit ac762111f79b2d0aa1ab9f97b5fb3d2ce3cc6a4a +Subproject commit 21421309a2b188b750e5f68a0b24f9ec9b95e627 From 3258d8eee514be5198819e33b60c63853d669f0e Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 2 Nov 2023 17:47:44 +0100 Subject: [PATCH 030/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 21421309a..fc308cf58 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 21421309a2b188b750e5f68a0b24f9ec9b95e627 +Subproject commit fc308cf58e789f6cb1ae289c70a50a8fc4ce5e38 From 5ef08c8de863e1d1894c4f743c375b2d8ed2f4f5 Mon Sep 17 00:00:00 2001 From: asahtik Date: Fri, 3 Nov 2023 08:22:35 +0100 Subject: [PATCH 031/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 34ffec9c8..79c1d67d5 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 34ffec9c851f7ee065a89c7eb6187871cd90855e +Subproject commit 79c1d67d5f58bb720ee783847fe4ec8430aa3663 From de02c648906014c6fcf54fadc5a657fff3d8caee Mon Sep 17 00:00:00 2001 From: asahtik Date: Fri, 3 Nov 2023 09:16:45 +0100 Subject: [PATCH 032/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 79c1d67d5..af9de8c41 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 79c1d67d5f58bb720ee783847fe4ec8430aa3663 +Subproject commit af9de8c41bf1de44b319d13be691d34dca46405c From 784ed42b9ff1256454556a9811a8c895a9e36d37 Mon Sep 17 00:00:00 2001 From: asahtik Date: Fri, 3 Nov 2023 10:16:21 +0100 Subject: [PATCH 033/105] Bumo core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index af9de8c41..06672b706 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit af9de8c41bf1de44b319d13be691d34dca46405c +Subproject commit 06672b706362b9217e139a7ad730360d4eda351f From e1463888f713e0a254be4edd2b0620c0f8265c72 Mon Sep 17 00:00:00 2001 From: asahtik Date: Fri, 3 Nov 2023 10:19:44 +0100 Subject: [PATCH 034/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 06672b706..b910590ff 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 06672b706362b9217e139a7ad730360d4eda351f +Subproject commit b910590ffddf758548d9269bd5393a3a55e8c769 From 1ea482ac3d6ba39ebc6fd86cc8655701d15a90ad Mon Sep 17 00:00:00 2001 From: Martin Peterlin Date: Fri, 3 Nov 2023 15:06:16 +0100 Subject: [PATCH 035/105] Some changes WRT Android build --- CMakeLists.txt | 4 ++-- depthai-core | 2 +- setup.py | 5 +++++ src/py_bindings.cpp | 26 +++++++++++++++++++++++++- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8fc4fee8..ac3c48597 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,8 +173,8 @@ endif() # Add stubs (pyi) generation step after building bindings execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "from mypy import api" RESULT_VARIABLE error OUTPUT_QUIET ERROR_QUIET) -if(error) - message(WARNING "Mypy not available - stubs won't be generated or checked") +if(error OR CMAKE_CROSSCOMPILING) + message(WARNING "Mypy not available or cross compiling - stubs won't be generated or checked") else() get_target_property(bindings_directory ${TARGET_NAME} LIBRARY_OUTPUT_DIRECTORY) if(NOT bindings_directory) diff --git a/depthai-core b/depthai-core index faa86aea3..a730a33ee 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit faa86aea31011fdabf52370f4defd5deddff08e3 +Subproject commit a730a33ee29cdbe5d6110cb2bedff8a78cf20093 diff --git a/setup.py b/setup.py index 341ab5f24..7dfd75015 100644 --- a/setup.py +++ b/setup.py @@ -142,6 +142,11 @@ def build_extension(self, ext): freeMemory = 4000 # Configure and build + + # Add additional cmake build args from environment + if 'CMAKE_BUILD_ARGS' in os.environ: + build_args += [os.environ['CMAKE_BUILD_ARGS']] + # Windows if platform.system() == "Windows": cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(cfg.upper(), extdir)] diff --git a/src/py_bindings.cpp b/src/py_bindings.cpp index e6db7796f..864704a74 100644 --- a/src/py_bindings.cpp +++ b/src/py_bindings.cpp @@ -82,9 +82,33 @@ PYBIND11_MODULE(depthai, m) // ignore } + // Apply JavaVM pointer + std::string javavmEnvStr; + constexpr static const char* javavmEnvKey = "DEPTHAI_LIBUSB_ANDROID_JAVAVM"; + try { + auto sysModule = py::module_::import("sys"); + if(py::hasattr(sysModule, javavmEnvKey)){ + javavmEnvStr = sysModule.attr(javavmEnvKey).cast(); + } + } catch (...) { + // ignore + } + try { + auto builtinsModule = py::module_::import("builtins"); + if(py::hasattr(builtinsModule, javavmEnvKey)){ + javavmEnvStr = builtinsModule.attr(javavmEnvKey).cast(); + } + } catch (...){ + // ignore + } + // JNIEnv handling + void* javavm = nullptr; + // Read the uintptr_t value from the decimal string + sscanf(javavmEnvStr.c_str(), "%" SCNuPTR, reinterpret_cast(&javavm)); + // Call dai::initialize on 'import depthai' to initialize asap with additional information to print try { - dai::initialize(std::string("Python bindings - version: ") + DEPTHAI_PYTHON_VERSION + " from " + DEPTHAI_PYTHON_COMMIT_DATETIME + " build: " + DEPTHAI_PYTHON_BUILD_DATETIME, installSignalHandler); + dai::initialize(std::string("Python bindings - version: ") + DEPTHAI_PYTHON_VERSION + " from " + DEPTHAI_PYTHON_COMMIT_DATETIME + " build: " + DEPTHAI_PYTHON_BUILD_DATETIME, installSignalHandler, javavm); } catch (const std::exception&) { // ignore, will be initialized later on if possible } From ef924c3565d33ebb5a925e5443157d423d936c84 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Sun, 5 Nov 2023 00:47:42 +0200 Subject: [PATCH 036/105] Fix multi stereo node race condition when depth output is enabled --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index a730a33ee..0abf5fd85 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit a730a33ee29cdbe5d6110cb2bedff8a78cf20093 +Subproject commit 0abf5fd859b51d9b431c6bcc80dccc6914fa5e81 From a1941bbff48d08726909f938d7b26084606b3008 Mon Sep 17 00:00:00 2001 From: zrezke Date: Mon, 6 Nov 2023 13:15:48 +0100 Subject: [PATCH 037/105] Ir brightness control based on normalized intensity, instead of current. --- depthai-core | 2 +- examples/MonoCamera/mono_preview_alternate_pro.py | 4 ++-- src/DeviceBindings.cpp | 4 ++-- utilities/cam_test.py | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/depthai-core b/depthai-core index b910590ff..4a711692a 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit b910590ffddf758548d9269bd5393a3a55e8c769 +Subproject commit 4a711692a43bae0e0173874a33376d4613a68d57 diff --git a/examples/MonoCamera/mono_preview_alternate_pro.py b/examples/MonoCamera/mono_preview_alternate_pro.py index 6f5997150..93bb13ca8 100755 --- a/examples/MonoCamera/mono_preview_alternate_pro.py +++ b/examples/MonoCamera/mono_preview_alternate_pro.py @@ -43,8 +43,8 @@ script = pipeline.create(dai.node.Script) script.setProcessor(dai.ProcessorType.LEON_CSS) script.setScript(""" - dotBright = 500 # Note: recommended to not exceed 765, for max duty cycle - floodBright = 200 + dotBright = 0.8 + floodBright = 0.1 LOGGING = False # Set `True` for latency/timings debugging node.warn(f'IR drivers detected: {str(Device.getIrDrivers())}') diff --git a/src/DeviceBindings.cpp b/src/DeviceBindings.cpp index 447ab9f81..9adb85d57 100644 --- a/src/DeviceBindings.cpp +++ b/src/DeviceBindings.cpp @@ -635,8 +635,8 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){ .def("flashCalibration", [](DeviceBase& d, CalibrationHandler calibrationDataHandler) { py::gil_scoped_release release; return d.flashCalibration(calibrationDataHandler); }, py::arg("calibrationDataHandler"), DOC(dai, DeviceBase, flashCalibration)) .def("setXLinkChunkSize", [](DeviceBase& d, int s) { py::gil_scoped_release release; d.setXLinkChunkSize(s); }, py::arg("sizeBytes"), DOC(dai, DeviceBase, setXLinkChunkSize)) .def("getXLinkChunkSize", [](DeviceBase& d) { py::gil_scoped_release release; return d.getXLinkChunkSize(); }, DOC(dai, DeviceBase, getXLinkChunkSize)) - .def("setIrLaserDotProjectorBrightness", [](DeviceBase& d, float m, int mask) { py::gil_scoped_release release; return d.setIrLaserDotProjectorBrightness(m, mask); }, py::arg("mA"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrLaserDotProjectorBrightness)) - .def("setIrFloodLightBrightness", [](DeviceBase& d, float m, int mask) { py::gil_scoped_release release; return d.setIrFloodLightBrightness(m, mask); }, py::arg("mA"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrFloodLightBrightness)) + .def("setIrLaserDotProjectorBrightness", [](DeviceBase& d, float intensity, int mask) { py::gil_scoped_release release; return d.setIrLaserDotProjectorBrightness(intensity, mask); }, py::arg("intensity"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrLaserDotProjectorBrightness)) + .def("setIrFloodLightBrightness", [](DeviceBase& d, float intensity, int mask) { py::gil_scoped_release release; return d.setIrFloodLightBrightness(intensity, mask); }, py::arg("intensity"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrFloodLightBrightness)) .def("getIrDrivers", [](DeviceBase& d) { py::gil_scoped_release release; return d.getIrDrivers(); }, DOC(dai, DeviceBase, getIrDrivers)) .def("isEepromAvailable", [](DeviceBase& d) { py::gil_scoped_release release; return d.isEepromAvailable(); }, DOC(dai, DeviceBase, isEepromAvailable)) .def("flashCalibration2", [](DeviceBase& d, CalibrationHandler ch) { py::gil_scoped_release release; return d.flashCalibration2(ch); }, DOC(dai, DeviceBase, flashCalibration2)) diff --git a/utilities/cam_test.py b/utilities/cam_test.py index aaa55f882..a79fbec3f 100755 --- a/utilities/cam_test.py +++ b/utilities/cam_test.py @@ -354,10 +354,10 @@ def exit_cleanly(signum, frame): EXP_STEP = 500 # us ISO_STEP = 50 LENS_STEP = 3 - DOT_STEP = 100 - FLOOD_STEP = 100 - DOT_MAX = 1200 - FLOOD_MAX = 1500 + DOT_STEP = 1 / 12 + FLOOD_STEP = 1 / 15 + DOT_MAX = 1 + FLOOD_MAX = 1 # Defaults and limits for manual focus/exposure controls lensPos = 150 From 760b89551db4aee448aa94a1d46c2b1826d9ebf5 Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 6 Nov 2023 13:30:43 +0100 Subject: [PATCH 038/105] Bump core (rewrite msggrps) --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index a2f409267..2319297ae 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit a2f4092674105f442b484803bb938505dcd3a8b1 +Subproject commit 2319297ae48d0a6d1f6a1a67a0446d50dec85e0b From 6d9c841945b54b09f6e7745e4cc8c49e8809f1b5 Mon Sep 17 00:00:00 2001 From: Chenna Kautilya Date: Fri, 3 Nov 2023 16:47:24 -0700 Subject: [PATCH 039/105] fix: release gil on close() --- src/DataQueueBindings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DataQueueBindings.cpp b/src/DataQueueBindings.cpp index 557ae573f..f940dfd2c 100644 --- a/src/DataQueueBindings.cpp +++ b/src/DataQueueBindings.cpp @@ -51,7 +51,7 @@ void DataQueueBindings::bind(pybind11::module& m, void* pCallstack){ dataOutputQueue .def("getName", &DataOutputQueue::getName, DOC(dai, DataOutputQueue, getName)) .def("isClosed", &DataOutputQueue::isClosed, DOC(dai, DataOutputQueue, isClosed)) - .def("close", &DataOutputQueue::close, DOC(dai, DataOutputQueue, close)) + .def("close", &DataOutputQueue::close, DOC(dai, DataOutputQueue, close), py::call_guard()) .def("addCallback", addCallbackLambda, py::arg("callback"), DOC(dai, DataOutputQueue, addCallback)) .def("addCallback", addCallbackLambda, py::arg("callback"), DOC(dai, DataOutputQueue, addCallback, 2)) @@ -114,7 +114,7 @@ void DataQueueBindings::bind(pybind11::module& m, void* pCallstack){ // Bind DataInputQueue dataInputQueue .def("isClosed", &DataInputQueue::isClosed, DOC(dai, DataInputQueue, isClosed)) - .def("close", &DataInputQueue::close, DOC(dai, DataInputQueue, close)) + .def("close", &DataInputQueue::close, DOC(dai, DataInputQueue, close), py::call_guard()) .def("getName", &DataInputQueue::getName, DOC(dai, DataInputQueue, getName)) .def("setBlocking", &DataInputQueue::setBlocking, py::arg("blocking"), DOC(dai, DataInputQueue, setBlocking)) .def("getBlocking", &DataInputQueue::getBlocking, DOC(dai, DataInputQueue, getBlocking)) From e7657e8e25c7ef8c5cb9e330793bd57383044bbb Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 6 Nov 2023 15:04:04 +0100 Subject: [PATCH 040/105] Added ability to only demux successfuly synced groups --- depthai-core | 2 +- src/pipeline/datatype/MessageGroupBindings.cpp | 1 + src/pipeline/node/MessageDemuxBindings.cpp | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/depthai-core b/depthai-core index 2319297ae..a1e6bf16f 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 2319297ae48d0a6d1f6a1a67a0446d50dec85e0b +Subproject commit a1e6bf16f26762601fb17f2fe4fb3ef4b96af5d0 diff --git a/src/pipeline/datatype/MessageGroupBindings.cpp b/src/pipeline/datatype/MessageGroupBindings.cpp index 7bbf560f3..46d6d97e7 100644 --- a/src/pipeline/datatype/MessageGroupBindings.cpp +++ b/src/pipeline/datatype/MessageGroupBindings.cpp @@ -58,6 +58,7 @@ void bind_message_group(pybind11::module& m, void* pCallstack){ .def("setTimestamp", &MessageGroup::setTimestamp, DOC(dai, MessageGroup, setTimestamp)) .def("setTimestampDevice", &MessageGroup::setTimestampDevice, DOC(dai, MessageGroup, setTimestampDevice)) .def("setSequenceNum", &MessageGroup::setSequenceNum, DOC(dai, MessageGroup, setSequenceNum)) + .def("setSuccess", &MessageGroup::setSuccess, DOC(dai, MessageGroup, setSuccess)) ; } diff --git a/src/pipeline/node/MessageDemuxBindings.cpp b/src/pipeline/node/MessageDemuxBindings.cpp index 253830a4e..6f845fb7c 100644 --- a/src/pipeline/node/MessageDemuxBindings.cpp +++ b/src/pipeline/node/MessageDemuxBindings.cpp @@ -36,7 +36,10 @@ void bind_messagedemux(pybind11::module &m, void *pCallstack) { .def_readonly("outputs", &MessageDemux::outputs, DOC(dai, node, MessageDemux, outputs)) .def_readonly("input", &MessageDemux::input, - DOC(dai, node, MessageDemux, in)); + DOC(dai, node, MessageDemux, in)) + .def("setDemuxOnlyOnSuccessful", &MessageDemux::setDemuxOnlyOnSuccessful, + py::arg("demuxOnlyOnSuccessful"), + DOC(dai, node, Sync, setDemuxOnlyOnSuccessful)); daiNodeModule.attr("MessageDemux").attr("Properties") = messageDemuxProperties; } From 2423686322f50beb02d33b633433df43697688fe Mon Sep 17 00:00:00 2001 From: zrezke Date: Mon, 6 Nov 2023 18:09:06 +0100 Subject: [PATCH 041/105] Added IR intensity API. --- depthai-core | 2 +- src/DeviceBindings.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/depthai-core b/depthai-core index 4a711692a..ab88129d9 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 4a711692a43bae0e0173874a33376d4613a68d57 +Subproject commit ab88129d920c3d671f5ea5c0141f8f0c503bd36b diff --git a/src/DeviceBindings.cpp b/src/DeviceBindings.cpp index 9adb85d57..7da34ec74 100644 --- a/src/DeviceBindings.cpp +++ b/src/DeviceBindings.cpp @@ -635,8 +635,10 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){ .def("flashCalibration", [](DeviceBase& d, CalibrationHandler calibrationDataHandler) { py::gil_scoped_release release; return d.flashCalibration(calibrationDataHandler); }, py::arg("calibrationDataHandler"), DOC(dai, DeviceBase, flashCalibration)) .def("setXLinkChunkSize", [](DeviceBase& d, int s) { py::gil_scoped_release release; d.setXLinkChunkSize(s); }, py::arg("sizeBytes"), DOC(dai, DeviceBase, setXLinkChunkSize)) .def("getXLinkChunkSize", [](DeviceBase& d) { py::gil_scoped_release release; return d.getXLinkChunkSize(); }, DOC(dai, DeviceBase, getXLinkChunkSize)) - .def("setIrLaserDotProjectorBrightness", [](DeviceBase& d, float intensity, int mask) { py::gil_scoped_release release; return d.setIrLaserDotProjectorBrightness(intensity, mask); }, py::arg("intensity"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrLaserDotProjectorBrightness)) - .def("setIrFloodLightBrightness", [](DeviceBase& d, float intensity, int mask) { py::gil_scoped_release release; return d.setIrFloodLightBrightness(intensity, mask); }, py::arg("intensity"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrFloodLightBrightness)) + .def("setIrLaserDotProjectorBrightness", [](DeviceBase& d, float mA, int mask) { py::gil_scoped_release release; return d.setIrLaserDotProjectorBrightness(mA, mask); }, py::arg("mA"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrLaserDotProjectorBrightness)) + .def("setIrFloodLightBrightness", [](DeviceBase& d, float mA, int mask) { py::gil_scoped_release release; return d.setIrFloodLightBrightness(mA, mask); }, py::arg("mA"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrFloodLightBrightness)) + .def("setIrLaserDotProjectorIntensity", [](DeviceBase& d, float intensity, int mask) { py::gil_scoped_release release; return d.setIrLaserDotProjectorIntensity(intensity, mask); }, py::arg("intensity"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrLaserDotProjectorIntensity)) + .def("setIrFloodLightIntensity", [](DeviceBase& d, float intensity, int mask) { py::gil_scoped_release release; return d.setIrFloodLightIntensity(intensity, mask); }, py::arg("intensity"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrFloodLightIntensity)) .def("getIrDrivers", [](DeviceBase& d) { py::gil_scoped_release release; return d.getIrDrivers(); }, DOC(dai, DeviceBase, getIrDrivers)) .def("isEepromAvailable", [](DeviceBase& d) { py::gil_scoped_release release; return d.isEepromAvailable(); }, DOC(dai, DeviceBase, isEepromAvailable)) .def("flashCalibration2", [](DeviceBase& d, CalibrationHandler ch) { py::gil_scoped_release release; return d.flashCalibration2(ch); }, DOC(dai, DeviceBase, flashCalibration2)) From ce621ef55137dc9eeed9e2ebd68c56635c1c380f Mon Sep 17 00:00:00 2001 From: asahtik Date: Tue, 7 Nov 2023 09:54:24 +0100 Subject: [PATCH 042/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 0abf5fd85..04e09ab03 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 0abf5fd859b51d9b431c6bcc80dccc6914fa5e81 +Subproject commit 04e09ab032d9ed05adee7f8add97c38ba8889f06 From 20f716a6e2fb7a2449ecd28b04bd29a9dd9cc8cb Mon Sep 17 00:00:00 2001 From: alex-luxonis Date: Wed, 8 Nov 2023 03:58:11 +0200 Subject: [PATCH 043/105] Add tests/multithread.py, can replicate a few failures: - depthai.XLinkWriteError: Couldn't write data to stream: '__bootloader' (X_LINK_ERROR) - RuntimeError: Error trying to connect to device - ...ping was missed, closing the device connection Tested on PoE, 5+ devices connected. Fix will follow in next commit --- tests/multithread.py | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/multithread.py diff --git a/tests/multithread.py b/tests/multithread.py new file mode 100644 index 000000000..6252527aa --- /dev/null +++ b/tests/multithread.py @@ -0,0 +1,46 @@ +# TODO: increase defaults in depthai! Below is a workaround for this issue on some setups: +# Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND +# If this error is still observed, might be a FW crash on initialization +if 1: + import os + os.environ["DEPTHAI_WATCHDOG_INITIAL_DELAY"] = "40000" + os.environ["DEPTHAI_BOOTUP_TIMEOUT"] = "40000" + +import depthai as dai +import threading +import traceback +import time +import os + +def worker(devinfo, id): + print(f'[{id}] opening bootloader...') + try: + with dai.DeviceBootloader(devinfo) as bl: + print(f'[{id}] bootloader version: {bl.getVersion()}') + with dai.Device(devinfo) as dev: + print(f'[{id}] device started, name: {dev.getDeviceName()}') + time.sleep(6) + # Exceptions aren't propagated, so simply exit the app with an error + except Exception as e: + print(f'[{id}] FAILED: {e}') + traceback.print_exc() + os._exit(-1) + +device_infos = dai.Device.getAllAvailableDevices() +n = len(device_infos) +if n <= 0: + print('No devices found!') + os._exit(-1) +print(f'Found {n} devices, handling each in a thread...') +threads = [] +for devinfo in device_infos: + id = devinfo.name # IP address for PoE + t = threading.Thread(target=worker, args=(devinfo, id, )) + t.name += f'-{id}' # Thread name useful for debugging + t.start() + threads.append(t) + +for t in threads: + t.join() + +print('Multi-threading test succeeded!') From 628e4ceb537b38e7346a280fd2bb84fb867a647a Mon Sep 17 00:00:00 2001 From: alex-luxonis Date: Wed, 8 Nov 2023 05:19:52 +0200 Subject: [PATCH 044/105] Fix XLink linkId reuse, caused multi-threading failures --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 0abf5fd85..3433a5ab8 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 0abf5fd859b51d9b431c6bcc80dccc6914fa5e81 +Subproject commit 3433a5ab8de627d1d7563f44efeb912a9798a898 From 684dd41ba18a577d501649436116e60b2ca7d2b1 Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 8 Nov 2023 09:11:53 +0100 Subject: [PATCH 045/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 04e09ab03..9e94ce88e 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 04e09ab032d9ed05adee7f8add97c38ba8889f06 +Subproject commit 9e94ce88ee64d42b8e6190f8d9d4254b7b72ef20 From e1122c30d73e31c16f96cbd99260a287266a2bf2 Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 8 Nov 2023 09:22:42 +0100 Subject: [PATCH 046/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 9e94ce88e..7042f218d 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 9e94ce88ee64d42b8e6190f8d9d4254b7b72ef20 +Subproject commit 7042f218da5ed8d1e78b681264c1276174b543a8 From be73c4fe9f3c7b844db7d33fa81157f5ec5020ab Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 8 Nov 2023 14:09:38 +0100 Subject: [PATCH 047/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 0abf5fd85..3844391b2 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 0abf5fd859b51d9b431c6bcc80dccc6914fa5e81 +Subproject commit 3844391b24f6d4b1c40ad965263d8a092d148e54 From 2007a99faa4696bd3e4121e96743a93b1f498c69 Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 8 Nov 2023 16:34:25 +0100 Subject: [PATCH 048/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 4b943ea77..6e8e67df7 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 4b943ea77adfe7a36f5ac35e40b5f97af463c08e +Subproject commit 6e8e67df7c3b3cd1f1ba57f544799a8eedb72353 From c750c68bc16446ac43304ef741e19088013c84a2 Mon Sep 17 00:00:00 2001 From: asahtik Date: Fri, 10 Nov 2023 11:41:58 +0100 Subject: [PATCH 049/105] Renamed getConnectivity --- depthai-core | 2 +- src/DeviceBindings.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/depthai-core b/depthai-core index 7042f218d..268b6b844 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 7042f218da5ed8d1e78b681264c1276174b543a8 +Subproject commit 268b6b84478885c93a9950f418632d6da5546656 diff --git a/src/DeviceBindings.cpp b/src/DeviceBindings.cpp index f274c405d..12a146ae4 100644 --- a/src/DeviceBindings.cpp +++ b/src/DeviceBindings.cpp @@ -611,7 +611,7 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){ .def("getCrashDump", [](DeviceBase& d, bool clearCrashDump) { py::gil_scoped_release release; return d.getCrashDump(clearCrashDump); }, py::arg("clearCrashDump") = true, DOC(dai, DeviceBase, getCrashDump)) .def("hasCrashDump", [](DeviceBase& d) { py::gil_scoped_release release; return d.hasCrashDump(); }, DOC(dai, DeviceBase, hasCrashDump)) .def("getConnectedCameras", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectedCameras(); }, DOC(dai, DeviceBase, getConnectedCameras)) - .def("getConnectivity", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectivity(); }, DOC(dai, DeviceBase, getConnectivity)) + .def("getAvailableInterfaces", [](DeviceBase& d) { py::gil_scoped_release release; return d.getAvailableInterfaces(); }, DOC(dai, DeviceBase, getConnectivity)) .def("getConnectedCameraFeatures", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectedCameraFeatures(); }, DOC(dai, DeviceBase, getConnectedCameraFeatures)) .def("getCameraSensorNames", [](DeviceBase& d) { py::gil_scoped_release release; return d.getCameraSensorNames(); }, DOC(dai, DeviceBase, getCameraSensorNames)) .def("getConnectedIMU", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectedIMU(); }, DOC(dai, DeviceBase, getConnectedIMU)) From 5d6e1d356163c2fdf53148fe33b80b472c553ee2 Mon Sep 17 00:00:00 2001 From: zrezke Date: Fri, 10 Nov 2023 14:37:15 +0100 Subject: [PATCH 050/105] Update docstring. Point to correct device side commit. --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index ab88129d9..e4943f279 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit ab88129d920c3d671f5ea5c0141f8f0c503bd36b +Subproject commit e4943f279e4e96d299368caf826a803b824338c5 From bf0289193c3eeb2c952d3af56ecffc42e0d33189 Mon Sep 17 00:00:00 2001 From: zrezke Date: Fri, 10 Nov 2023 14:38:28 +0100 Subject: [PATCH 051/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index e4943f279..7fa88bca1 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit e4943f279e4e96d299368caf826a803b824338c5 +Subproject commit 7fa88bca19c4c11d6ce8f2afd118bfa1db45ef0d From 0f37f1d8552364cc26d66970cb823bc53eef390c Mon Sep 17 00:00:00 2001 From: zrezke Date: Fri, 10 Nov 2023 19:53:19 +0100 Subject: [PATCH 052/105] Use IR intensity API in cam_test.py --- utilities/cam_test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utilities/cam_test.py b/utilities/cam_test.py index a79fbec3f..d21984e43 100755 --- a/utilities/cam_test.py +++ b/utilities/cam_test.py @@ -556,25 +556,25 @@ def exit_cleanly(signum, frame): dotIntensity = dotIntensity - DOT_STEP if dotIntensity < 0: dotIntensity = 0 - device.setIrLaserDotProjectorBrightness(dotIntensity) + device.setIrLaserDotProjectorIntensity(dotIntensity) print(f'IR Dot intensity:', dotIntensity) elif key == ord('d'): dotIntensity = dotIntensity + DOT_STEP if dotIntensity > DOT_MAX: dotIntensity = DOT_MAX - device.setIrLaserDotProjectorBrightness(dotIntensity) + device.setIrLaserDotProjectorIntensity(dotIntensity) print(f'IR Dot intensity:', dotIntensity) elif key == ord('w'): floodIntensity = floodIntensity + FLOOD_STEP if floodIntensity > FLOOD_MAX: floodIntensity = FLOOD_MAX - device.setIrFloodLightBrightness(floodIntensity) + device.setIrFloodLightIntensity(floodIntensity) print(f'IR Flood intensity:', floodIntensity) elif key == ord('s'): floodIntensity = floodIntensity - FLOOD_STEP if floodIntensity < 0: floodIntensity = 0 - device.setIrFloodLightBrightness(floodIntensity) + device.setIrFloodLightIntensity(floodIntensity) print(f'IR Flood intensity:', floodIntensity) elif key >= 0 and chr(key) in '34567890[]p\\;\'': if key == ord('3'): From 063a8b97fe411df4e5ec08b517a786797d7bc131 Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 13 Nov 2023 09:35:46 +0100 Subject: [PATCH 053/105] Renamed getAvailableInterfaces --- depthai-core | 2 +- src/DeviceBindings.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/depthai-core b/depthai-core index 268b6b844..8b2df03e9 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 268b6b84478885c93a9950f418632d6da5546656 +Subproject commit 8b2df03e9f3987d39061cb79620f3581efacb2e0 diff --git a/src/DeviceBindings.cpp b/src/DeviceBindings.cpp index 12a146ae4..de0fcf29d 100644 --- a/src/DeviceBindings.cpp +++ b/src/DeviceBindings.cpp @@ -611,7 +611,7 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){ .def("getCrashDump", [](DeviceBase& d, bool clearCrashDump) { py::gil_scoped_release release; return d.getCrashDump(clearCrashDump); }, py::arg("clearCrashDump") = true, DOC(dai, DeviceBase, getCrashDump)) .def("hasCrashDump", [](DeviceBase& d) { py::gil_scoped_release release; return d.hasCrashDump(); }, DOC(dai, DeviceBase, hasCrashDump)) .def("getConnectedCameras", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectedCameras(); }, DOC(dai, DeviceBase, getConnectedCameras)) - .def("getAvailableInterfaces", [](DeviceBase& d) { py::gil_scoped_release release; return d.getAvailableInterfaces(); }, DOC(dai, DeviceBase, getConnectivity)) + .def("getConnectionInterfaces", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectionInterfaces(); }, DOC(dai, DeviceBase, getConnectivity)) .def("getConnectedCameraFeatures", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectedCameraFeatures(); }, DOC(dai, DeviceBase, getConnectedCameraFeatures)) .def("getCameraSensorNames", [](DeviceBase& d) { py::gil_scoped_release release; return d.getCameraSensorNames(); }, DOC(dai, DeviceBase, getCameraSensorNames)) .def("getConnectedIMU", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectedIMU(); }, DOC(dai, DeviceBase, getConnectedIMU)) From 83ead49d56ce6825550d01d22a76ccb618b10fd6 Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 13 Nov 2023 11:11:08 +0100 Subject: [PATCH 054/105] Added an example for encframe --- .../VideoEncoder/rgb_encoding_encodedframe.py | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 examples/VideoEncoder/rgb_encoding_encodedframe.py diff --git a/examples/VideoEncoder/rgb_encoding_encodedframe.py b/examples/VideoEncoder/rgb_encoding_encodedframe.py new file mode 100755 index 000000000..febea0ef1 --- /dev/null +++ b/examples/VideoEncoder/rgb_encoding_encodedframe.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 + +import depthai as dai + +def frametype2str(ft): + if ft == dai.EncodedFrame.FrameType.I: + return "I" + elif ft == dai.EncodedFrame.FrameType.P: + return "P" + elif ft == dai.EncodedFrame.FrameType.B: + return "B" + +def compress(ls): + curr = ls[0] + count = 1 + res = [] + for i in range(1, len(ls)): + if ls[i] == curr: + count += 1 + else: + res.append((count, curr)) + curr = ls[i] + count = 1 + res.append((count, curr)) + return res + + +# Create pipeline +pipeline = dai.Pipeline() + +# Define sources and output +camRgb = pipeline.create(dai.node.ColorCamera) +videoEnc = pipeline.create(dai.node.VideoEncoder) +xout = pipeline.create(dai.node.XLinkOut) + +xout.setStreamName('h265') + +# Properties +camRgb.setBoardSocket(dai.CameraBoardSocket.CAM_A) +camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_4_K) +videoEnc.setDefaultProfilePreset(30, dai.VideoEncoderProperties.Profile.H265_MAIN) + +# Linking +camRgb.video.link(videoEnc.input) +videoEnc.out.link(xout.input) + +frametypes = [] +# Connect to device and start pipeline +with dai.Device(pipeline) as device: + + # Output queue will be used to get the encoded data from the output defined above + q = device.getOutputQueue(name="h265", maxSize=30, blocking=True) + + # The .h265 file is a raw stream file (not playable yet) + with open('video.h265', 'wb') as videoFile: + print("Press Ctrl+C to stop encoding...") + try: + while True: + h265Packet = q.get() # Blocking call, will wait until a new data has arrived + frametypes.append(frametype2str(h265Packet.getFrameType())) + h265Packet.getData().tofile(videoFile) # Appends the packet data to the opened file + except KeyboardInterrupt: + # Keyboard interrupt (Ctrl + C) detected + pass + + print("To view the encoded data, convert the stream file (.h265) into a video file (.mp4) using a command below:") + print("ffmpeg -framerate 30 -i video.h265 -c copy video.mp4") + +print(",".join([f"{c}{f}" for c, f in compress(frametypes)])) From c8ccafe14b54d1cc9488e9b8f4af89b4750d5cdd Mon Sep 17 00:00:00 2001 From: zrezke Date: Mon, 13 Nov 2023 12:05:02 +0100 Subject: [PATCH 055/105] Deprecated ir brightness api, fixed mono_preview_alternate_pro.py example --- depthai-core | 2 +- .../MonoCamera/mono_preview_alternate_pro.py | 4 ++-- src/DeviceBindings.cpp | 20 +++++++++++++++++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/depthai-core b/depthai-core index 7fa88bca1..444a1c0d6 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 7fa88bca19c4c11d6ce8f2afd118bfa1db45ef0d +Subproject commit 444a1c0d6399947d323a1f43438061485ab77173 diff --git a/examples/MonoCamera/mono_preview_alternate_pro.py b/examples/MonoCamera/mono_preview_alternate_pro.py index 93bb13ca8..9d6e53800 100755 --- a/examples/MonoCamera/mono_preview_alternate_pro.py +++ b/examples/MonoCamera/mono_preview_alternate_pro.py @@ -57,8 +57,8 @@ # Immediately reconfigure the IR driver. # Note the logic is inverted, as it applies for next frame - Device.setIrLaserDotProjectorBrightness(0 if flagDot else dotBright) - Device.setIrFloodLightBrightness(floodBright if flagDot else 0) + Device.setIrLaserDotProjectorIntensity(0 if flagDot else dotBright) + Device.setIrFloodLightIntensity(floodBright if flagDot else 0) if LOGGING: tIrSet = Clock.now() # Wait for the actual frames (after MIPI capture and ISP proc is done) diff --git a/src/DeviceBindings.cpp b/src/DeviceBindings.cpp index 7da34ec74..fff460bd2 100644 --- a/src/DeviceBindings.cpp +++ b/src/DeviceBindings.cpp @@ -635,8 +635,24 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){ .def("flashCalibration", [](DeviceBase& d, CalibrationHandler calibrationDataHandler) { py::gil_scoped_release release; return d.flashCalibration(calibrationDataHandler); }, py::arg("calibrationDataHandler"), DOC(dai, DeviceBase, flashCalibration)) .def("setXLinkChunkSize", [](DeviceBase& d, int s) { py::gil_scoped_release release; d.setXLinkChunkSize(s); }, py::arg("sizeBytes"), DOC(dai, DeviceBase, setXLinkChunkSize)) .def("getXLinkChunkSize", [](DeviceBase& d) { py::gil_scoped_release release; return d.getXLinkChunkSize(); }, DOC(dai, DeviceBase, getXLinkChunkSize)) - .def("setIrLaserDotProjectorBrightness", [](DeviceBase& d, float mA, int mask) { py::gil_scoped_release release; return d.setIrLaserDotProjectorBrightness(mA, mask); }, py::arg("mA"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrLaserDotProjectorBrightness)) - .def("setIrFloodLightBrightness", [](DeviceBase& d, float mA, int mask) { py::gil_scoped_release release; return d.setIrFloodLightBrightness(mA, mask); }, py::arg("mA"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrFloodLightBrightness)) + .def("setIrLaserDotProjectorBrightness", [](DeviceBase& d, float mA, int mask) { + PyErr_WarnEx(PyExc_DeprecationWarning, "Use setIrLaserDotProjectorIntensity() instead.", 1); + HEDLEY_DIAGNOSTIC_PUSH + HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED + py::gil_scoped_release release; + bool result = d.setIrLaserDotProjectorBrightness(mA, mask); + HEDLEY_DIAGNOSTIC_POP + return result; + }, py::arg("mA"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrLaserDotProjectorBrightness)) + .def("setIrFloodLightBrightness", [](DeviceBase& d, float mA, int mask) { + PyErr_WarnEx(PyExc_DeprecationWarning, "Use setIrFloodLightIntensity() instead.", 1); + HEDLEY_DIAGNOSTIC_PUSH + HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED + py::gil_scoped_release release; + bool result = d.setIrFloodLightBrightness(mA, mask); + HEDLEY_DIAGNOSTIC_POP + return result; + }, py::arg("mA"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrFloodLightBrightness)) .def("setIrLaserDotProjectorIntensity", [](DeviceBase& d, float intensity, int mask) { py::gil_scoped_release release; return d.setIrLaserDotProjectorIntensity(intensity, mask); }, py::arg("intensity"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrLaserDotProjectorIntensity)) .def("setIrFloodLightIntensity", [](DeviceBase& d, float intensity, int mask) { py::gil_scoped_release release; return d.setIrFloodLightIntensity(intensity, mask); }, py::arg("intensity"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrFloodLightIntensity)) .def("getIrDrivers", [](DeviceBase& d) { py::gil_scoped_release release; return d.getIrDrivers(); }, DOC(dai, DeviceBase, getIrDrivers)) From c022aecc852fdc959ddb95fd330fcd4caba49404 Mon Sep 17 00:00:00 2001 From: zrezke Date: Mon, 13 Nov 2023 23:24:59 +0100 Subject: [PATCH 056/105] cam test: use step 0.05 for both dot projector and flood light --- utilities/cam_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/cam_test.py b/utilities/cam_test.py index d21984e43..aded6bdfa 100755 --- a/utilities/cam_test.py +++ b/utilities/cam_test.py @@ -354,8 +354,8 @@ def exit_cleanly(signum, frame): EXP_STEP = 500 # us ISO_STEP = 50 LENS_STEP = 3 - DOT_STEP = 1 / 12 - FLOOD_STEP = 1 / 15 + DOT_STEP = 0.05 + FLOOD_STEP = 0.05 DOT_MAX = 1 FLOOD_MAX = 1 From d71394026dfcb8c9d9ae2f5d14cdaedb7b3ff532 Mon Sep 17 00:00:00 2001 From: asahtik Date: Tue, 14 Nov 2023 17:02:01 +0100 Subject: [PATCH 057/105] Bugfixes, changes to sync, msggrp, demux --- depthai-core | 2 +- src/pipeline/datatype/EncodedFrameBindings.cpp | 14 +++++++------- src/pipeline/datatype/MessageGroupBindings.cpp | 5 ++--- src/pipeline/node/MessageDemuxBindings.cpp | 4 ++-- src/pipeline/node/SyncBindings.cpp | 4 ++-- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/depthai-core b/depthai-core index 6e8e67df7..57e4c10b2 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 6e8e67df7c3b3cd1f1ba57f544799a8eedb72353 +Subproject commit 57e4c10b23f8343b24f4de7e7b3ccd679946af28 diff --git a/src/pipeline/datatype/EncodedFrameBindings.cpp b/src/pipeline/datatype/EncodedFrameBindings.cpp index ed5018c3c..91bda7f1f 100644 --- a/src/pipeline/datatype/EncodedFrameBindings.cpp +++ b/src/pipeline/datatype/EncodedFrameBindings.cpp @@ -82,15 +82,15 @@ void bind_encodedframe(pybind11::module &m, void *pCallstack) { .def(py::init<>()) // getters .def("getTimestamp", - py::overload_cast<>(&EncodedFrame::getTimestamp, py::const_), - DOC(dai, EncodedFrame, getTimestamp)) + py::overload_cast<>(&EncodedFrame::Buffer::getTimestamp, py::const_), + DOC(dai, Buffer, getTimestamp)) .def("getTimestampDevice", - py::overload_cast<>(&EncodedFrame::getTimestampDevice, py::const_), - DOC(dai, EncodedFrame, getTimestampDevice)) + py::overload_cast<>(&EncodedFrame::Buffer::getTimestampDevice, py::const_), + DOC(dai, Buffer, getTimestampDevice)) .def("getInstanceNum", &EncodedFrame::getInstanceNum, DOC(dai, EncodedFrame, getInstanceNum)) - .def("getSequenceNum", &EncodedFrame::getSequenceNum, - DOC(dai, EncodedFrame, getSequenceNum)) + .def("getSequenceNum", &EncodedFrame::Buffer::getSequenceNum, + DOC(dai, Buffer, getSequenceNum)) .def("getExposureTime", &EncodedFrame::getExposureTime, DOC(dai, EncodedFrame, getExposureTime)) .def("getSensitivity", &EncodedFrame::getSensitivity, @@ -116,7 +116,7 @@ void bind_encodedframe(pybind11::module &m, void *pCallstack) { .def("setTimestampDevice", &EncodedFrame::setTimestampDevice, DOC(dai, EncodedFrame, setTimestampDevice)) .def("setSequenceNum", &EncodedFrame::setSequenceNum, - DOC(dai, EncodedFrame, getSequenceNum)) + DOC(dai, EncodedFrame, setSequenceNum)) .def("setQuality", &EncodedFrame::setQuality, DOC(dai, EncodedFrame, getQuality)) .def("setBitrate", &EncodedFrame::setBitrate, diff --git a/src/pipeline/datatype/MessageGroupBindings.cpp b/src/pipeline/datatype/MessageGroupBindings.cpp index 46d6d97e7..9ad32048d 100644 --- a/src/pipeline/datatype/MessageGroupBindings.cpp +++ b/src/pipeline/datatype/MessageGroupBindings.cpp @@ -37,7 +37,6 @@ void bind_message_group(pybind11::module& m, void* pCallstack){ rawMessageGroup .def(py::init<>()) .def_readwrite("group", &RawMessageGroup::group) - .def_readwrite("success", &RawMessageGroup::success) ; // Message @@ -47,10 +46,10 @@ void bind_message_group(pybind11::module& m, void* pCallstack){ std::shared_ptr data = nullptr; return msg[name]; }) - .def("__setitem__", [](MessageGroup& msg, const std::string& name, std::shared_ptr data) { + .def("__setitem__", [](MessageGroup& msg, const std::string& name, std::shared_ptr data) { return msg.add(name, data); }) - .def("syncSuccessful", &MessageGroup::syncSuccessful, DOC(dai, MessageGroup, syncSuccessful)) + .def("isSynced", &MessageGroup::isSynced, DOC(dai, MessageGroup, isSynced)) .def("getIntervalNs", &MessageGroup::getIntervalNs, DOC(dai, MessageGroup, getIntervalNs)) .def("getTimestamp", &MessageGroup::Buffer::getTimestamp, DOC(dai, Buffer, getTimestamp)) .def("getTimestampDevice", &MessageGroup::Buffer::getTimestampDevice, DOC(dai, Buffer, getTimestampDevice)) diff --git a/src/pipeline/node/MessageDemuxBindings.cpp b/src/pipeline/node/MessageDemuxBindings.cpp index 6f845fb7c..fe61e2b25 100644 --- a/src/pipeline/node/MessageDemuxBindings.cpp +++ b/src/pipeline/node/MessageDemuxBindings.cpp @@ -36,10 +36,10 @@ void bind_messagedemux(pybind11::module &m, void *pCallstack) { .def_readonly("outputs", &MessageDemux::outputs, DOC(dai, node, MessageDemux, outputs)) .def_readonly("input", &MessageDemux::input, - DOC(dai, node, MessageDemux, in)) + DOC(dai, node, MessageDemux, input)) .def("setDemuxOnlyOnSuccessful", &MessageDemux::setDemuxOnlyOnSuccessful, py::arg("demuxOnlyOnSuccessful"), - DOC(dai, node, Sync, setDemuxOnlyOnSuccessful)); + DOC(dai, node, MessageDemux, setDemuxOnlyOnSuccessful)); daiNodeModule.attr("MessageDemux").attr("Properties") = messageDemuxProperties; } diff --git a/src/pipeline/node/SyncBindings.cpp b/src/pipeline/node/SyncBindings.cpp index fc7a8e8d4..07bbff90d 100644 --- a/src/pipeline/node/SyncBindings.cpp +++ b/src/pipeline/node/SyncBindings.cpp @@ -38,9 +38,9 @@ void bind_sync(pybind11::module& m, void* pCallstack){ sync .def_readonly("out", &Sync::out, DOC(dai, node, Sync, out)) .def_readonly("inputs", &Sync::inputs, DOC(dai, node, Sync, inputs)) - .def("setSyncIntervalMs", &Sync::setSyncIntervalMs, py::arg("syncInterval"), DOC(dai, node, Sync, setSyncInterval)) + .def("setSyncThresholdMs", &Sync::setSyncThresholdMs, py::arg("syncInterval"), DOC(dai, node, Sync, setSyncThresholdMs)) .def("setSyncAttempts", &Sync::setSyncAttempts, py::arg("maxDataSize"), DOC(dai, node, Sync, setSyncAttempts)) - .def("getSyncIntervalMs", &Sync::getSyncIntervalMs, DOC(dai, node, Sync, getSyncIntervalMs)) + .def("getSyncThresholdMs", &Sync::getSyncThresholdMs, DOC(dai, node, Sync, getSyncThresholdMs)) .def("getSyncAttempts", &Sync::getSyncAttempts, DOC(dai, node, Sync, getSyncAttempts)) ; daiNodeModule.attr("Sync").attr("Properties") = syncProperties; From e01046b6d7e0c21b8f76a17d9513d257c64d8142 Mon Sep 17 00:00:00 2001 From: asahtik Date: Tue, 14 Nov 2023 17:02:01 +0100 Subject: [PATCH 058/105] Fix docstrings build - partial cherry-pick of d713940 "Bugfixes, changes to sync, msggrp, demux" --- src/pipeline/datatype/EncodedFrameBindings.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pipeline/datatype/EncodedFrameBindings.cpp b/src/pipeline/datatype/EncodedFrameBindings.cpp index ed5018c3c..91bda7f1f 100644 --- a/src/pipeline/datatype/EncodedFrameBindings.cpp +++ b/src/pipeline/datatype/EncodedFrameBindings.cpp @@ -82,15 +82,15 @@ void bind_encodedframe(pybind11::module &m, void *pCallstack) { .def(py::init<>()) // getters .def("getTimestamp", - py::overload_cast<>(&EncodedFrame::getTimestamp, py::const_), - DOC(dai, EncodedFrame, getTimestamp)) + py::overload_cast<>(&EncodedFrame::Buffer::getTimestamp, py::const_), + DOC(dai, Buffer, getTimestamp)) .def("getTimestampDevice", - py::overload_cast<>(&EncodedFrame::getTimestampDevice, py::const_), - DOC(dai, EncodedFrame, getTimestampDevice)) + py::overload_cast<>(&EncodedFrame::Buffer::getTimestampDevice, py::const_), + DOC(dai, Buffer, getTimestampDevice)) .def("getInstanceNum", &EncodedFrame::getInstanceNum, DOC(dai, EncodedFrame, getInstanceNum)) - .def("getSequenceNum", &EncodedFrame::getSequenceNum, - DOC(dai, EncodedFrame, getSequenceNum)) + .def("getSequenceNum", &EncodedFrame::Buffer::getSequenceNum, + DOC(dai, Buffer, getSequenceNum)) .def("getExposureTime", &EncodedFrame::getExposureTime, DOC(dai, EncodedFrame, getExposureTime)) .def("getSensitivity", &EncodedFrame::getSensitivity, @@ -116,7 +116,7 @@ void bind_encodedframe(pybind11::module &m, void *pCallstack) { .def("setTimestampDevice", &EncodedFrame::setTimestampDevice, DOC(dai, EncodedFrame, setTimestampDevice)) .def("setSequenceNum", &EncodedFrame::setSequenceNum, - DOC(dai, EncodedFrame, getSequenceNum)) + DOC(dai, EncodedFrame, setSequenceNum)) .def("setQuality", &EncodedFrame::setQuality, DOC(dai, EncodedFrame, getQuality)) .def("setBitrate", &EncodedFrame::setBitrate, From 3d03da7bc5ee58b3ba09b047c435f73c561710bf Mon Sep 17 00:00:00 2001 From: alex-luxonis Date: Wed, 15 Nov 2023 05:55:39 +0200 Subject: [PATCH 059/105] Add CameraControl `setAutoExposureLimit`. FW: improve OV9282/OV9782 image quality in low-light / under high ISO (1300+) --- depthai-core | 2 +- src/pipeline/datatype/CameraControlBindings.cpp | 3 +++ utilities/cam_test.py | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 444a1c0d6..060e8d0a7 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 444a1c0d6399947d323a1f43438061485ab77173 +Subproject commit 060e8d0a7afc8d217e1fcf5ecb73efb3857ee1fd diff --git a/src/pipeline/datatype/CameraControlBindings.cpp b/src/pipeline/datatype/CameraControlBindings.cpp index 7ebdeead8..07a77d843 100644 --- a/src/pipeline/datatype/CameraControlBindings.cpp +++ b/src/pipeline/datatype/CameraControlBindings.cpp @@ -185,6 +185,7 @@ std::vector camCtrlAttr; .def_readwrite("captureIntent", &RawCameraControl::captureIntent) .def_readwrite("controlMode", &RawCameraControl::controlMode) .def_readwrite("effectMode", &RawCameraControl::effectMode) + .def_readwrite("aeMaxExposureTimeUs", &RawCameraControl::aeMaxExposureTimeUs) .def_readwrite("aeLockMode", &RawCameraControl::aeLockMode) .def_readwrite("awbLockMode", &RawCameraControl::awbLockMode) .def_readwrite("expCompensation", &RawCameraControl::expCompensation) @@ -221,6 +222,8 @@ std::vector camCtrlAttr; .def("setAutoExposureLock", &CameraControl::setAutoExposureLock, py::arg("lock"), DOC(dai, CameraControl, setAutoExposureLock)) .def("setAutoExposureRegion", &CameraControl::setAutoExposureRegion, py::arg("startX"), py::arg("startY"), py::arg("width"), py::arg("height"), DOC(dai, CameraControl, setAutoExposureRegion)) .def("setAutoExposureCompensation", &CameraControl::setAutoExposureCompensation, py::arg("compensation"), DOC(dai, CameraControl, setAutoExposureCompensation)) + .def("setAutoExposureLimit", py::overload_cast(&CameraControl::setAutoExposureLimit), py::arg("maxExposureTimeUs"), DOC(dai, CameraControl, setAutoExposureLimit)) + .def("setAutoExposureLimit", py::overload_cast(&CameraControl::setAutoExposureLimit), py::arg("maxExposureTime"), DOC(dai, CameraControl, setAutoExposureLimit, 2)) .def("setAntiBandingMode", &CameraControl::setAntiBandingMode, py::arg("mode"), DOC(dai, CameraControl, setAntiBandingMode)) .def("setManualExposure", py::overload_cast(&CameraControl::setManualExposure), py::arg("exposureTimeUs"), py::arg("sensitivityIso"), DOC(dai, CameraControl, setManualExposure)) .def("setManualExposure", py::overload_cast(&CameraControl::setManualExposure), py::arg("exposureTime"), py::arg("sensitivityIso"), DOC(dai, CameraControl, setManualExposure, 2)) diff --git a/utilities/cam_test.py b/utilities/cam_test.py index aded6bdfa..1f47523a9 100755 --- a/utilities/cam_test.py +++ b/utilities/cam_test.py @@ -285,6 +285,7 @@ def prev(self): # cam[c].initialControl.setManualExposure(15000, 400) # exposure [us], iso # When set, takes effect after the first 2 frames # cam[c].initialControl.setManualWhiteBalance(4000) # light temperature in K, 1000..12000 + # cam[c].initialControl.setAutoExposureLimit(5000) # can also be updated at runtime control.out.link(cam[c].inputControl) if rotate[c]: cam[c].setImageOrientation(dai.CameraImageOrientation.ROTATE_180_DEG) From 4308c3e8ae6e15032197dbdf7edf5ad7dc6034f6 Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 15 Nov 2023 10:09:37 +0100 Subject: [PATCH 060/105] Changed the way sync is configured --- depthai-core | 2 +- src/pipeline/datatype/MessageGroupBindings.cpp | 1 - src/pipeline/node/MessageDemuxBindings.cpp | 5 +---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/depthai-core b/depthai-core index 57e4c10b2..daba8516a 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 57e4c10b23f8343b24f4de7e7b3ccd679946af28 +Subproject commit daba8516ab7b1f290d3bc16485840ce716928fb7 diff --git a/src/pipeline/datatype/MessageGroupBindings.cpp b/src/pipeline/datatype/MessageGroupBindings.cpp index 9ad32048d..80bb352c7 100644 --- a/src/pipeline/datatype/MessageGroupBindings.cpp +++ b/src/pipeline/datatype/MessageGroupBindings.cpp @@ -57,7 +57,6 @@ void bind_message_group(pybind11::module& m, void* pCallstack){ .def("setTimestamp", &MessageGroup::setTimestamp, DOC(dai, MessageGroup, setTimestamp)) .def("setTimestampDevice", &MessageGroup::setTimestampDevice, DOC(dai, MessageGroup, setTimestampDevice)) .def("setSequenceNum", &MessageGroup::setSequenceNum, DOC(dai, MessageGroup, setSequenceNum)) - .def("setSuccess", &MessageGroup::setSuccess, DOC(dai, MessageGroup, setSuccess)) ; } diff --git a/src/pipeline/node/MessageDemuxBindings.cpp b/src/pipeline/node/MessageDemuxBindings.cpp index fe61e2b25..84f83aaf8 100644 --- a/src/pipeline/node/MessageDemuxBindings.cpp +++ b/src/pipeline/node/MessageDemuxBindings.cpp @@ -36,10 +36,7 @@ void bind_messagedemux(pybind11::module &m, void *pCallstack) { .def_readonly("outputs", &MessageDemux::outputs, DOC(dai, node, MessageDemux, outputs)) .def_readonly("input", &MessageDemux::input, - DOC(dai, node, MessageDemux, input)) - .def("setDemuxOnlyOnSuccessful", &MessageDemux::setDemuxOnlyOnSuccessful, - py::arg("demuxOnlyOnSuccessful"), - DOC(dai, node, MessageDemux, setDemuxOnlyOnSuccessful)); + DOC(dai, node, MessageDemux, input)); daiNodeModule.attr("MessageDemux").attr("Properties") = messageDemuxProperties; } From 901fd9ba46e09e2012867be881cf3532eb8a0a53 Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 15 Nov 2023 10:11:46 +0100 Subject: [PATCH 061/105] Clangformat --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index daba8516a..bb8ebd491 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit daba8516ab7b1f290d3bc16485840ce716928fb7 +Subproject commit bb8ebd491360c94588f41ecf7a075d9620e036a4 From 850746a6c3a9250be80c2a2eea89704af52a4ee5 Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 15 Nov 2023 11:24:50 +0100 Subject: [PATCH 062/105] Added examples --- depthai-core | 2 +- examples/Sync/demux_message_group.py | 56 +++++++++++++++++++ examples/Sync/sync_scripts.py | 52 +++++++++++++++++ .../datatype/MessageGroupBindings.cpp | 2 + 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 examples/Sync/demux_message_group.py create mode 100644 examples/Sync/sync_scripts.py diff --git a/depthai-core b/depthai-core index bb8ebd491..190fdc004 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit bb8ebd491360c94588f41ecf7a075d9620e036a4 +Subproject commit 190fdc0043f43d1aaf2851d023612b2fcbad6006 diff --git a/examples/Sync/demux_message_group.py b/examples/Sync/demux_message_group.py new file mode 100644 index 000000000..bca7a63cb --- /dev/null +++ b/examples/Sync/demux_message_group.py @@ -0,0 +1,56 @@ +import depthai as dai +import time + +pipeline = dai.Pipeline() + +script1 = pipeline.create(dai.node.Script) +script1.setScript(""" +from time import sleep + +while True: + sleep(1) + b = Buffer(512) + b.setData(bytes(4 * [i for i in range(0, 128)])) + b.setTimestamp(Clock.now()) + node.io['out'].send(b) +""") + +script2 = pipeline.create(dai.node.Script) +script2.setScript(""" +from time import sleep + +while True: + sleep(0.3) + b = Buffer(512) + b.setData(bytes(4 * [i for i in range(128, 256)])) + b.setTimestamp(Clock.now()) + node.io['out'].send(b) +""") + +sync = pipeline.create(dai.node.Sync) +sync.setSyncThresholdMs(100) + +demux = pipeline.create(dai.node.MessageDemux) + +xout1 = pipeline.create(dai.node.XLinkOut) +xout1.setStreamName("xout1") +xout2 = pipeline.create(dai.node.XLinkOut) +xout2.setStreamName("xout2") + +script1.outputs["out"].link(sync.inputs["s1"]) +script2.outputs["out"].link(sync.inputs["s2"]) +sync.out.link(demux.input) +demux.outputs["s1"].link(xout1.input) +demux.outputs["s2"].link(xout2.input) + +with dai.Device(pipeline) as device: + print("Start") + q1 = device.getOutputQueue("xout1", maxSize=10, blocking=True) + q2 = device.getOutputQueue("xout2", maxSize=10, blocking=True) + while True: + bufS1 = q1.get() + bufS2 = q2.get() + print(f"Buffer 1 timestamp: {bufS1.getTimestamp()}") + print(f"Buffer 2 timestamp: {bufS2.getTimestamp()}") + print("----------") + time.sleep(0.2) diff --git a/examples/Sync/sync_scripts.py b/examples/Sync/sync_scripts.py new file mode 100644 index 000000000..c925809d6 --- /dev/null +++ b/examples/Sync/sync_scripts.py @@ -0,0 +1,52 @@ +import depthai as dai +import time + +pipeline = dai.Pipeline() + +script1 = pipeline.create(dai.node.Script) +script1.setScript(""" +from time import sleep + +while True: + sleep(1) + b = Buffer(512) + b.setData(bytes(4 * [i for i in range(0, 128)])) + b.setTimestamp(Clock.now()) + node.io['out'].send(b) +""") + +script2 = pipeline.create(dai.node.Script) +script2.setScript(""" +from time import sleep + +while True: + sleep(0.3) + b = Buffer(512) + b.setData(bytes(4 * [i for i in range(128, 256)])) + b.setTimestamp(Clock.now()) + node.io['out'].send(b) +""") + +sync = pipeline.create(dai.node.Sync) +sync.setSyncThresholdMs(100) + +xout = pipeline.create(dai.node.XLinkOut) +xout.setStreamName("xout") + +sync.out.link(xout.input) + +script1.outputs["out"].link(sync.inputs["s1"]) +script2.outputs["out"].link(sync.inputs["s2"]) + +# script1.outputs["out"].link(xout.input) + +with dai.Device(pipeline) as device: + print("Start") + q = device.getOutputQueue("xout", maxSize=10, blocking=True) + while True: + grp = q.get() + print(f"Buffer 1 timestamp: {grp["s1"].getTimestamp()}") + print(f"Buffer 2 timestamp: {grp["s2"].getTimestamp()}") + print(f"Time interval between messages: {grp.getIntervalNs() / 1e6}ms") + print("----------") + time.sleep(0.2) diff --git a/src/pipeline/datatype/MessageGroupBindings.cpp b/src/pipeline/datatype/MessageGroupBindings.cpp index 80bb352c7..4b82733e3 100644 --- a/src/pipeline/datatype/MessageGroupBindings.cpp +++ b/src/pipeline/datatype/MessageGroupBindings.cpp @@ -51,6 +51,8 @@ void bind_message_group(pybind11::module& m, void* pCallstack){ }) .def("isSynced", &MessageGroup::isSynced, DOC(dai, MessageGroup, isSynced)) .def("getIntervalNs", &MessageGroup::getIntervalNs, DOC(dai, MessageGroup, getIntervalNs)) + .def("getNumMessages", &MessageGroup::getNumMessages, DOC(dai, MessageGroup, getNumMessages)) + .def("getMessageNames", &MessageGroup::getMessageNames, DOC(dai, MessageGroup, getMessageNames)) .def("getTimestamp", &MessageGroup::Buffer::getTimestamp, DOC(dai, Buffer, getTimestamp)) .def("getTimestampDevice", &MessageGroup::Buffer::getTimestampDevice, DOC(dai, Buffer, getTimestampDevice)) .def("getSequenceNum", &MessageGroup::Buffer::getSequenceNum, DOC(dai, Buffer, getSequenceNum)) From 21da65adf9cff962ad94c457f461f48c00ee434c Mon Sep 17 00:00:00 2001 From: Erol444 Date: Thu, 12 Oct 2023 16:00:23 +0200 Subject: [PATCH 063/105] Required for python linting --- src/pipeline/PipelineBindings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pipeline/PipelineBindings.cpp b/src/pipeline/PipelineBindings.cpp index 839944b9f..103e4f8f4 100644 --- a/src/pipeline/PipelineBindings.cpp +++ b/src/pipeline/PipelineBindings.cpp @@ -145,6 +145,7 @@ void PipelineBindings::bind(pybind11::module& m, void* pCallstack){ .def("createDetectionParser", &Pipeline::create) .def("createUVC", &Pipeline::create) .def("createCamera", &Pipeline::create) + .def("createWarp", &Pipeline::create) ; From cf64f2c2073a8e5b32a8660b4564e9dc4bda2496 Mon Sep 17 00:00:00 2001 From: asahtik Date: Fri, 17 Nov 2023 17:03:24 +0100 Subject: [PATCH 064/105] Added iterator for MsgGrp and an example --- depthai-core | 2 +- examples/Sync/depth_video_synced.py | 47 +++++++++++++++++++ examples/Sync/sync_scripts.py | 4 +- .../datatype/MessageGroupBindings.cpp | 3 +- 4 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 examples/Sync/depth_video_synced.py diff --git a/depthai-core b/depthai-core index 190fdc004..8a5175b5a 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 190fdc0043f43d1aaf2851d023612b2fcbad6006 +Subproject commit 8a5175b5aa0097a96f362a9acc2762b1c19dc262 diff --git a/examples/Sync/depth_video_synced.py b/examples/Sync/depth_video_synced.py new file mode 100644 index 000000000..3bd2610cc --- /dev/null +++ b/examples/Sync/depth_video_synced.py @@ -0,0 +1,47 @@ +import depthai as dai +import numpy as np +import cv2 + +pipeline = dai.Pipeline() + +monoLeft = pipeline.create(dai.node.MonoCamera) +monoRight = pipeline.create(dai.node.MonoCamera) +color = pipeline.create(dai.node.ColorCamera) +stereo = pipeline.create(dai.node.StereoDepth) +sync = pipeline.create(dai.node.Sync) + +xoutGrp = pipeline.create(dai.node.XLinkOut) + +xoutGrp.setStreamName("xout") + +monoLeft.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P) +monoLeft.setCamera("left") +monoRight.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P) +monoLeft.setCamera("right") + +stereo.setDefaultProfilePreset(dai.node.StereoDepth.PresetMode.HIGH_ACCURACY) + +color.setCamera("color") + +sync.setSyncThresholdMs(100) + +monoLeft.out.link(stereo.left) +monoRight.out.link(stereo.right) + +stereo.depth.link(sync.inputs["depth"]) +color.video.link(sync.inputs["video"]) + +sync.out.link(xoutGrp.input) + +with dai.Device(pipeline) as device: + queue = device.getOutputQueue("xout", 10, False) + while True: + msgGrp = queue.get() + for name, msg in msgGrp: + frame = msg.getCvFrame() + if name == "depth": + frame = frame.astype(np.uint16) + cv2.imshow(name, frame) + if cv2.waitKey(100) == ord("q"): + break + diff --git a/examples/Sync/sync_scripts.py b/examples/Sync/sync_scripts.py index c925809d6..a64712b20 100644 --- a/examples/Sync/sync_scripts.py +++ b/examples/Sync/sync_scripts.py @@ -45,8 +45,8 @@ q = device.getOutputQueue("xout", maxSize=10, blocking=True) while True: grp = q.get() - print(f"Buffer 1 timestamp: {grp["s1"].getTimestamp()}") - print(f"Buffer 2 timestamp: {grp["s2"].getTimestamp()}") + for name, msg in grp: + print(f"Received {name} with timestamp {msg.getTimestamp()}") print(f"Time interval between messages: {grp.getIntervalNs() / 1e6}ms") print("----------") time.sleep(0.2) diff --git a/src/pipeline/datatype/MessageGroupBindings.cpp b/src/pipeline/datatype/MessageGroupBindings.cpp index 4b82733e3..a77c5fbd5 100644 --- a/src/pipeline/datatype/MessageGroupBindings.cpp +++ b/src/pipeline/datatype/MessageGroupBindings.cpp @@ -43,12 +43,13 @@ void bind_message_group(pybind11::module& m, void* pCallstack){ messageGroup .def(py::init<>()) .def("__getitem__", [](MessageGroup& msg, const std::string& name) { - std::shared_ptr data = nullptr; return msg[name]; }) .def("__setitem__", [](MessageGroup& msg, const std::string& name, std::shared_ptr data) { return msg.add(name, data); }) + .def("__iter__", [](MessageGroup& msg) { return py::make_iterator(msg.begin(), msg.end()); }, + py::keep_alive<0, 1>() /* Essential: keep object alive while iterator exists */) .def("isSynced", &MessageGroup::isSynced, DOC(dai, MessageGroup, isSynced)) .def("getIntervalNs", &MessageGroup::getIntervalNs, DOC(dai, MessageGroup, getIntervalNs)) .def("getNumMessages", &MessageGroup::getNumMessages, DOC(dai, MessageGroup, getNumMessages)) From 047fd6b64a38390bb46600e42bd73afa679e3037 Mon Sep 17 00:00:00 2001 From: asahtik Date: Fri, 17 Nov 2023 17:04:59 +0100 Subject: [PATCH 065/105] Bump core (fw) --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 8a5175b5a..f91a1bd33 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 8a5175b5aa0097a96f362a9acc2762b1c19dc262 +Subproject commit f91a1bd33dd7e949f3a4925912d9174ddc589fd6 From e98a371159d8da1890765a766030bce20be1873b Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 20 Nov 2023 10:55:35 +0100 Subject: [PATCH 066/105] Bump core + build fixes --- depthai-core | 2 +- src/pipeline/PipelineBindings.cpp | 1 + src/pipeline/datatype/EncodedFrameBindings.cpp | 14 +++++++------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/depthai-core b/depthai-core index 3844391b2..63529fc26 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 3844391b24f6d4b1c40ad965263d8a092d148e54 +Subproject commit 63529fc262a725151b6623c4a6e67f16b19b9d32 diff --git a/src/pipeline/PipelineBindings.cpp b/src/pipeline/PipelineBindings.cpp index 103e4f8f4..9c716d1aa 100644 --- a/src/pipeline/PipelineBindings.cpp +++ b/src/pipeline/PipelineBindings.cpp @@ -29,6 +29,7 @@ #include "depthai/pipeline/node/AprilTag.hpp" #include "depthai/pipeline/node/DetectionParser.hpp" #include "depthai/pipeline/node/UVC.hpp" +#include "depthai/pipeline/node/Warp.hpp" // depthai-shared #include "depthai-shared/properties/GlobalProperties.hpp" diff --git a/src/pipeline/datatype/EncodedFrameBindings.cpp b/src/pipeline/datatype/EncodedFrameBindings.cpp index ed5018c3c..91bda7f1f 100644 --- a/src/pipeline/datatype/EncodedFrameBindings.cpp +++ b/src/pipeline/datatype/EncodedFrameBindings.cpp @@ -82,15 +82,15 @@ void bind_encodedframe(pybind11::module &m, void *pCallstack) { .def(py::init<>()) // getters .def("getTimestamp", - py::overload_cast<>(&EncodedFrame::getTimestamp, py::const_), - DOC(dai, EncodedFrame, getTimestamp)) + py::overload_cast<>(&EncodedFrame::Buffer::getTimestamp, py::const_), + DOC(dai, Buffer, getTimestamp)) .def("getTimestampDevice", - py::overload_cast<>(&EncodedFrame::getTimestampDevice, py::const_), - DOC(dai, EncodedFrame, getTimestampDevice)) + py::overload_cast<>(&EncodedFrame::Buffer::getTimestampDevice, py::const_), + DOC(dai, Buffer, getTimestampDevice)) .def("getInstanceNum", &EncodedFrame::getInstanceNum, DOC(dai, EncodedFrame, getInstanceNum)) - .def("getSequenceNum", &EncodedFrame::getSequenceNum, - DOC(dai, EncodedFrame, getSequenceNum)) + .def("getSequenceNum", &EncodedFrame::Buffer::getSequenceNum, + DOC(dai, Buffer, getSequenceNum)) .def("getExposureTime", &EncodedFrame::getExposureTime, DOC(dai, EncodedFrame, getExposureTime)) .def("getSensitivity", &EncodedFrame::getSensitivity, @@ -116,7 +116,7 @@ void bind_encodedframe(pybind11::module &m, void *pCallstack) { .def("setTimestampDevice", &EncodedFrame::setTimestampDevice, DOC(dai, EncodedFrame, setTimestampDevice)) .def("setSequenceNum", &EncodedFrame::setSequenceNum, - DOC(dai, EncodedFrame, getSequenceNum)) + DOC(dai, EncodedFrame, setSequenceNum)) .def("setQuality", &EncodedFrame::setQuality, DOC(dai, EncodedFrame, getQuality)) .def("setBitrate", &EncodedFrame::setBitrate, From d8edfab580c10c1f1e064b08a4ad3713a2ca0b06 Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 20 Nov 2023 12:10:58 +0100 Subject: [PATCH 067/105] Changed example to use disparity instead of depth --- depthai-core | 2 +- examples/Sync/depth_video_synced.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/depthai-core b/depthai-core index f91a1bd33..2928de767 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit f91a1bd33dd7e949f3a4925912d9174ddc589fd6 +Subproject commit 2928de76706e9ce3a864954565ee68901febfae6 diff --git a/examples/Sync/depth_video_synced.py b/examples/Sync/depth_video_synced.py index 3bd2610cc..53a3c674c 100644 --- a/examples/Sync/depth_video_synced.py +++ b/examples/Sync/depth_video_synced.py @@ -23,25 +23,26 @@ color.setCamera("color") -sync.setSyncThresholdMs(100) +sync.setSyncThresholdMs(50) monoLeft.out.link(stereo.left) monoRight.out.link(stereo.right) -stereo.depth.link(sync.inputs["depth"]) +stereo.disparity.link(sync.inputs["disparity"]) color.video.link(sync.inputs["video"]) sync.out.link(xoutGrp.input) +disparityMultiplier = 255.0 / stereo.initialConfig.getMaxDisparity() with dai.Device(pipeline) as device: queue = device.getOutputQueue("xout", 10, False) while True: msgGrp = queue.get() for name, msg in msgGrp: frame = msg.getCvFrame() - if name == "depth": - frame = frame.astype(np.uint16) + if name == "disparity": + frame = (frame * disparityMultiplier).astype(np.uint8) + frame = cv2.applyColorMap(frame, cv2.COLORMAP_JET) cv2.imshow(name, frame) - if cv2.waitKey(100) == ord("q"): + if cv2.waitKey(1) == ord("q"): break - From 275d8b746f3b3801a160faebdbad39db78300edb Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 20 Nov 2023 12:11:47 +0100 Subject: [PATCH 068/105] Clangformat --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 2928de767..5bd2e4c24 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 2928de76706e9ce3a864954565ee68901febfae6 +Subproject commit 5bd2e4c242a4b4f009edfec2e8370bf3d3f63b26 From 1c817ce5f6e60766c73bf355c8515292a06178b7 Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 20 Nov 2023 13:13:55 +0100 Subject: [PATCH 069/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 63529fc26..f37c02321 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 63529fc262a725151b6623c4a6e67f16b19b9d32 +Subproject commit f37c02321b1718738c7920a601237c91a63d9e63 From d32e0497bc8d7f42136828ae490f9c74944b2353 Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 20 Nov 2023 13:30:33 +0100 Subject: [PATCH 070/105] Merge develop + build fixes --- depthai-core | 2 +- src/DeviceBindings.cpp | 2 +- src/pipeline/PipelineBindings.cpp | 1 + src/pipeline/datatype/EncodedFrameBindings.cpp | 14 +++++++------- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/depthai-core b/depthai-core index 8b2df03e9..22e513efc 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 8b2df03e9f3987d39061cb79620f3581efacb2e0 +Subproject commit 22e513efce56403053642ae5273afcf9400923c9 diff --git a/src/DeviceBindings.cpp b/src/DeviceBindings.cpp index de0fcf29d..add3b060b 100644 --- a/src/DeviceBindings.cpp +++ b/src/DeviceBindings.cpp @@ -611,7 +611,7 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){ .def("getCrashDump", [](DeviceBase& d, bool clearCrashDump) { py::gil_scoped_release release; return d.getCrashDump(clearCrashDump); }, py::arg("clearCrashDump") = true, DOC(dai, DeviceBase, getCrashDump)) .def("hasCrashDump", [](DeviceBase& d) { py::gil_scoped_release release; return d.hasCrashDump(); }, DOC(dai, DeviceBase, hasCrashDump)) .def("getConnectedCameras", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectedCameras(); }, DOC(dai, DeviceBase, getConnectedCameras)) - .def("getConnectionInterfaces", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectionInterfaces(); }, DOC(dai, DeviceBase, getConnectivity)) + .def("getConnectionInterfaces", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectionInterfaces(); }, DOC(dai, DeviceBase, getConnectionInterfaces)) .def("getConnectedCameraFeatures", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectedCameraFeatures(); }, DOC(dai, DeviceBase, getConnectedCameraFeatures)) .def("getCameraSensorNames", [](DeviceBase& d) { py::gil_scoped_release release; return d.getCameraSensorNames(); }, DOC(dai, DeviceBase, getCameraSensorNames)) .def("getConnectedIMU", [](DeviceBase& d) { py::gil_scoped_release release; return d.getConnectedIMU(); }, DOC(dai, DeviceBase, getConnectedIMU)) diff --git a/src/pipeline/PipelineBindings.cpp b/src/pipeline/PipelineBindings.cpp index 103e4f8f4..9c716d1aa 100644 --- a/src/pipeline/PipelineBindings.cpp +++ b/src/pipeline/PipelineBindings.cpp @@ -29,6 +29,7 @@ #include "depthai/pipeline/node/AprilTag.hpp" #include "depthai/pipeline/node/DetectionParser.hpp" #include "depthai/pipeline/node/UVC.hpp" +#include "depthai/pipeline/node/Warp.hpp" // depthai-shared #include "depthai-shared/properties/GlobalProperties.hpp" diff --git a/src/pipeline/datatype/EncodedFrameBindings.cpp b/src/pipeline/datatype/EncodedFrameBindings.cpp index ed5018c3c..91bda7f1f 100644 --- a/src/pipeline/datatype/EncodedFrameBindings.cpp +++ b/src/pipeline/datatype/EncodedFrameBindings.cpp @@ -82,15 +82,15 @@ void bind_encodedframe(pybind11::module &m, void *pCallstack) { .def(py::init<>()) // getters .def("getTimestamp", - py::overload_cast<>(&EncodedFrame::getTimestamp, py::const_), - DOC(dai, EncodedFrame, getTimestamp)) + py::overload_cast<>(&EncodedFrame::Buffer::getTimestamp, py::const_), + DOC(dai, Buffer, getTimestamp)) .def("getTimestampDevice", - py::overload_cast<>(&EncodedFrame::getTimestampDevice, py::const_), - DOC(dai, EncodedFrame, getTimestampDevice)) + py::overload_cast<>(&EncodedFrame::Buffer::getTimestampDevice, py::const_), + DOC(dai, Buffer, getTimestampDevice)) .def("getInstanceNum", &EncodedFrame::getInstanceNum, DOC(dai, EncodedFrame, getInstanceNum)) - .def("getSequenceNum", &EncodedFrame::getSequenceNum, - DOC(dai, EncodedFrame, getSequenceNum)) + .def("getSequenceNum", &EncodedFrame::Buffer::getSequenceNum, + DOC(dai, Buffer, getSequenceNum)) .def("getExposureTime", &EncodedFrame::getExposureTime, DOC(dai, EncodedFrame, getExposureTime)) .def("getSensitivity", &EncodedFrame::getSensitivity, @@ -116,7 +116,7 @@ void bind_encodedframe(pybind11::module &m, void *pCallstack) { .def("setTimestampDevice", &EncodedFrame::setTimestampDevice, DOC(dai, EncodedFrame, setTimestampDevice)) .def("setSequenceNum", &EncodedFrame::setSequenceNum, - DOC(dai, EncodedFrame, getSequenceNum)) + DOC(dai, EncodedFrame, setSequenceNum)) .def("setQuality", &EncodedFrame::setQuality, DOC(dai, EncodedFrame, getQuality)) .def("setBitrate", &EncodedFrame::setBitrate, From dac3938d0dc8b4c93c991e2663f8c4c5328c60ef Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 20 Nov 2023 13:53:19 +0100 Subject: [PATCH 071/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index f37c02321..a27df0616 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit f37c02321b1718738c7920a601237c91a63d9e63 +Subproject commit a27df0616efd4647ed34766d7ecd21c2ed33cd57 From 7646e8afc81cd624923d05f0cf9bab010beed0ce Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 20 Nov 2023 16:47:56 +0100 Subject: [PATCH 072/105] Changed syncThreshold setter to use chrono duration (timedelta) --- depthai-core | 2 +- examples/Sync/demux_message_group.py | 3 ++- examples/Sync/depth_video_synced.py | 3 ++- examples/Sync/sync_scripts.py | 3 ++- src/pipeline/node/SyncBindings.cpp | 6 +++--- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/depthai-core b/depthai-core index 3f50eaf13..e4bbd6eeb 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 3f50eaf13f1a1b3fd02986d2d16e7b4c16b8d783 +Subproject commit e4bbd6eeb77b0ef172e38a16c599b77fc3848026 diff --git a/examples/Sync/demux_message_group.py b/examples/Sync/demux_message_group.py index bca7a63cb..41c488f9c 100644 --- a/examples/Sync/demux_message_group.py +++ b/examples/Sync/demux_message_group.py @@ -1,5 +1,6 @@ import depthai as dai import time +from datetime import timedelta pipeline = dai.Pipeline() @@ -28,7 +29,7 @@ """) sync = pipeline.create(dai.node.Sync) -sync.setSyncThresholdMs(100) +sync.setSyncThresholdMs(timedelta(milliseconds=100)) demux = pipeline.create(dai.node.MessageDemux) diff --git a/examples/Sync/depth_video_synced.py b/examples/Sync/depth_video_synced.py index 53a3c674c..f572facfe 100644 --- a/examples/Sync/depth_video_synced.py +++ b/examples/Sync/depth_video_synced.py @@ -1,6 +1,7 @@ import depthai as dai import numpy as np import cv2 +from datetime import timedelta pipeline = dai.Pipeline() @@ -23,7 +24,7 @@ color.setCamera("color") -sync.setSyncThresholdMs(50) +sync.setSyncThreshold(timedelta(milliseconds=50)) monoLeft.out.link(stereo.left) monoRight.out.link(stereo.right) diff --git a/examples/Sync/sync_scripts.py b/examples/Sync/sync_scripts.py index a64712b20..3309dec8d 100644 --- a/examples/Sync/sync_scripts.py +++ b/examples/Sync/sync_scripts.py @@ -1,5 +1,6 @@ import depthai as dai import time +from datetime import timedelta pipeline = dai.Pipeline() @@ -28,7 +29,7 @@ """) sync = pipeline.create(dai.node.Sync) -sync.setSyncThresholdMs(100) +sync.setSyncThreshold(timedelta(milliseconds=100)) xout = pipeline.create(dai.node.XLinkOut) xout.setStreamName("xout") diff --git a/src/pipeline/node/SyncBindings.cpp b/src/pipeline/node/SyncBindings.cpp index 07bbff90d..10f384d5a 100644 --- a/src/pipeline/node/SyncBindings.cpp +++ b/src/pipeline/node/SyncBindings.cpp @@ -30,7 +30,7 @@ void bind_sync(pybind11::module& m, void* pCallstack){ // Properties syncProperties - .def_readwrite("syncIntervalMs", &SyncProperties::syncIntervalMs) + .def_readwrite("syncThresholdNs", &SyncProperties::syncThresholdNs) .def_readwrite("syncAttempts", &SyncProperties::syncAttempts) ; @@ -38,9 +38,9 @@ void bind_sync(pybind11::module& m, void* pCallstack){ sync .def_readonly("out", &Sync::out, DOC(dai, node, Sync, out)) .def_readonly("inputs", &Sync::inputs, DOC(dai, node, Sync, inputs)) - .def("setSyncThresholdMs", &Sync::setSyncThresholdMs, py::arg("syncInterval"), DOC(dai, node, Sync, setSyncThresholdMs)) + .def("setSyncThreshold", &Sync::setSyncThreshold, py::arg("syncThreshold"), DOC(dai, node, Sync, setSyncThreshold)) .def("setSyncAttempts", &Sync::setSyncAttempts, py::arg("maxDataSize"), DOC(dai, node, Sync, setSyncAttempts)) - .def("getSyncThresholdMs", &Sync::getSyncThresholdMs, DOC(dai, node, Sync, getSyncThresholdMs)) + .def("getSyncThreshold", &Sync::getSyncThreshold, DOC(dai, node, Sync, getSyncThreshold)) .def("getSyncAttempts", &Sync::getSyncAttempts, DOC(dai, node, Sync, getSyncAttempts)) ; daiNodeModule.attr("Sync").attr("Properties") = syncProperties; From 16f17b5363514a03cfacb043cf56995eb7e35700 Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 22 Nov 2023 10:10:01 +0100 Subject: [PATCH 073/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index e4bbd6eeb..af2ec1729 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit e4bbd6eeb77b0ef172e38a16c599b77fc3848026 +Subproject commit af2ec17297be23c26ac085b87bcdbd2b4931466b From f6049b83e4277e34b71975c05f8575b4461c0071 Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 23 Nov 2023 08:40:56 +0100 Subject: [PATCH 074/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index af2ec1729..eb1f60693 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit af2ec17297be23c26ac085b87bcdbd2b4931466b +Subproject commit eb1f60693265f2e0aba83ba27fbc9065624a95a6 From 7661cbc79f6a30b43b9f74877403ed33602fa4d4 Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 23 Nov 2023 10:32:02 +0100 Subject: [PATCH 075/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index a27df0616..7a6ca8f0e 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit a27df0616efd4647ed34766d7ecd21c2ed33cd57 +Subproject commit 7a6ca8f0e63e2ff5e70372f538f3fe60672d4d9f From 5df2d49f75a672696373b20db6d23256c84a1790 Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 23 Nov 2023 11:31:28 +0100 Subject: [PATCH 076/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index e325fed65..befbb2104 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit e325fed65bc205b4b2a0aacec7c45dee96659549 +Subproject commit befbb2104fefad99c17c836fc84eedeb4d3255a4 From 40ae8e4ee0eacff73bcce15a16565c744160731e Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 23 Nov 2023 14:56:21 +0100 Subject: [PATCH 077/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index befbb2104..a9a0b314a 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit befbb2104fefad99c17c836fc84eedeb4d3255a4 +Subproject commit a9a0b314a252d727e5a6fa875ee3e58cecef2e37 From 82713dc5e8f1bacbf4211aa621242aea8a45b76b Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 23 Nov 2023 16:49:49 +0100 Subject: [PATCH 078/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index eb1f60693..16ebb1735 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit eb1f60693265f2e0aba83ba27fbc9065624a95a6 +Subproject commit 16ebb17358d2cf03ff7b14cc32a1ad0cb9a32042 From 281c22f9f6597321add30a7934732000065e1dfc Mon Sep 17 00:00:00 2001 From: Filip Jeretina <59307111+zrezke@users.noreply.github.com> Date: Thu, 23 Nov 2023 23:04:17 +0100 Subject: [PATCH 079/105] IR intensity API (#920) * Ir brightness control based on normalized intensity, instead of current. * Added IR intensity API. * Update docstring. Point to correct device side commit. * Bump core * Use IR intensity API in cam_test.py * Deprecated ir brightness api, fixed mono_preview_alternate_pro.py example * cam test: use step 0.05 for both dot projector and flood light * Update core * synced depthai-shared with device side * resolve shared issue. * Bump core --- depthai-core | 2 +- .../MonoCamera/mono_preview_alternate_pro.py | 8 +++---- src/DeviceBindings.cpp | 22 +++++++++++++++++-- utilities/cam_test.py | 16 +++++++------- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/depthai-core b/depthai-core index 22e513efc..6a10051bf 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 22e513efce56403053642ae5273afcf9400923c9 +Subproject commit 6a10051bf745fa8ff0ee900718649111e3c460e6 diff --git a/examples/MonoCamera/mono_preview_alternate_pro.py b/examples/MonoCamera/mono_preview_alternate_pro.py index 6f5997150..9d6e53800 100755 --- a/examples/MonoCamera/mono_preview_alternate_pro.py +++ b/examples/MonoCamera/mono_preview_alternate_pro.py @@ -43,8 +43,8 @@ script = pipeline.create(dai.node.Script) script.setProcessor(dai.ProcessorType.LEON_CSS) script.setScript(""" - dotBright = 500 # Note: recommended to not exceed 765, for max duty cycle - floodBright = 200 + dotBright = 0.8 + floodBright = 0.1 LOGGING = False # Set `True` for latency/timings debugging node.warn(f'IR drivers detected: {str(Device.getIrDrivers())}') @@ -57,8 +57,8 @@ # Immediately reconfigure the IR driver. # Note the logic is inverted, as it applies for next frame - Device.setIrLaserDotProjectorBrightness(0 if flagDot else dotBright) - Device.setIrFloodLightBrightness(floodBright if flagDot else 0) + Device.setIrLaserDotProjectorIntensity(0 if flagDot else dotBright) + Device.setIrFloodLightIntensity(floodBright if flagDot else 0) if LOGGING: tIrSet = Clock.now() # Wait for the actual frames (after MIPI capture and ISP proc is done) diff --git a/src/DeviceBindings.cpp b/src/DeviceBindings.cpp index add3b060b..f994e9022 100644 --- a/src/DeviceBindings.cpp +++ b/src/DeviceBindings.cpp @@ -636,8 +636,26 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){ .def("flashCalibration", [](DeviceBase& d, CalibrationHandler calibrationDataHandler) { py::gil_scoped_release release; return d.flashCalibration(calibrationDataHandler); }, py::arg("calibrationDataHandler"), DOC(dai, DeviceBase, flashCalibration)) .def("setXLinkChunkSize", [](DeviceBase& d, int s) { py::gil_scoped_release release; d.setXLinkChunkSize(s); }, py::arg("sizeBytes"), DOC(dai, DeviceBase, setXLinkChunkSize)) .def("getXLinkChunkSize", [](DeviceBase& d) { py::gil_scoped_release release; return d.getXLinkChunkSize(); }, DOC(dai, DeviceBase, getXLinkChunkSize)) - .def("setIrLaserDotProjectorBrightness", [](DeviceBase& d, float m, int mask) { py::gil_scoped_release release; return d.setIrLaserDotProjectorBrightness(m, mask); }, py::arg("mA"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrLaserDotProjectorBrightness)) - .def("setIrFloodLightBrightness", [](DeviceBase& d, float m, int mask) { py::gil_scoped_release release; return d.setIrFloodLightBrightness(m, mask); }, py::arg("mA"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrFloodLightBrightness)) + .def("setIrLaserDotProjectorBrightness", [](DeviceBase& d, float mA, int mask) { + PyErr_WarnEx(PyExc_DeprecationWarning, "Use setIrLaserDotProjectorIntensity() instead.", 1); + HEDLEY_DIAGNOSTIC_PUSH + HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED + py::gil_scoped_release release; + bool result = d.setIrLaserDotProjectorBrightness(mA, mask); + HEDLEY_DIAGNOSTIC_POP + return result; + }, py::arg("mA"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrLaserDotProjectorBrightness)) + .def("setIrFloodLightBrightness", [](DeviceBase& d, float mA, int mask) { + PyErr_WarnEx(PyExc_DeprecationWarning, "Use setIrFloodLightIntensity() instead.", 1); + HEDLEY_DIAGNOSTIC_PUSH + HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED + py::gil_scoped_release release; + bool result = d.setIrFloodLightBrightness(mA, mask); + HEDLEY_DIAGNOSTIC_POP + return result; + }, py::arg("mA"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrFloodLightBrightness)) + .def("setIrLaserDotProjectorIntensity", [](DeviceBase& d, float intensity, int mask) { py::gil_scoped_release release; return d.setIrLaserDotProjectorIntensity(intensity, mask); }, py::arg("intensity"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrLaserDotProjectorIntensity)) + .def("setIrFloodLightIntensity", [](DeviceBase& d, float intensity, int mask) { py::gil_scoped_release release; return d.setIrFloodLightIntensity(intensity, mask); }, py::arg("intensity"), py::arg("mask") = -1, DOC(dai, DeviceBase, setIrFloodLightIntensity)) .def("getIrDrivers", [](DeviceBase& d) { py::gil_scoped_release release; return d.getIrDrivers(); }, DOC(dai, DeviceBase, getIrDrivers)) .def("isEepromAvailable", [](DeviceBase& d) { py::gil_scoped_release release; return d.isEepromAvailable(); }, DOC(dai, DeviceBase, isEepromAvailable)) .def("flashCalibration2", [](DeviceBase& d, CalibrationHandler ch) { py::gil_scoped_release release; return d.flashCalibration2(ch); }, DOC(dai, DeviceBase, flashCalibration2)) diff --git a/utilities/cam_test.py b/utilities/cam_test.py index aaa55f882..aded6bdfa 100755 --- a/utilities/cam_test.py +++ b/utilities/cam_test.py @@ -354,10 +354,10 @@ def exit_cleanly(signum, frame): EXP_STEP = 500 # us ISO_STEP = 50 LENS_STEP = 3 - DOT_STEP = 100 - FLOOD_STEP = 100 - DOT_MAX = 1200 - FLOOD_MAX = 1500 + DOT_STEP = 0.05 + FLOOD_STEP = 0.05 + DOT_MAX = 1 + FLOOD_MAX = 1 # Defaults and limits for manual focus/exposure controls lensPos = 150 @@ -556,25 +556,25 @@ def exit_cleanly(signum, frame): dotIntensity = dotIntensity - DOT_STEP if dotIntensity < 0: dotIntensity = 0 - device.setIrLaserDotProjectorBrightness(dotIntensity) + device.setIrLaserDotProjectorIntensity(dotIntensity) print(f'IR Dot intensity:', dotIntensity) elif key == ord('d'): dotIntensity = dotIntensity + DOT_STEP if dotIntensity > DOT_MAX: dotIntensity = DOT_MAX - device.setIrLaserDotProjectorBrightness(dotIntensity) + device.setIrLaserDotProjectorIntensity(dotIntensity) print(f'IR Dot intensity:', dotIntensity) elif key == ord('w'): floodIntensity = floodIntensity + FLOOD_STEP if floodIntensity > FLOOD_MAX: floodIntensity = FLOOD_MAX - device.setIrFloodLightBrightness(floodIntensity) + device.setIrFloodLightIntensity(floodIntensity) print(f'IR Flood intensity:', floodIntensity) elif key == ord('s'): floodIntensity = floodIntensity - FLOOD_STEP if floodIntensity < 0: floodIntensity = 0 - device.setIrFloodLightBrightness(floodIntensity) + device.setIrFloodLightIntensity(floodIntensity) print(f'IR Flood intensity:', floodIntensity) elif key >= 0 and chr(key) in '34567890[]p\\;\'': if key == ord('3'): From 0a187eb258f0228d02d0709e21382570b958811f Mon Sep 17 00:00:00 2001 From: asahtik Date: Fri, 24 Nov 2023 08:40:50 +0100 Subject: [PATCH 080/105] Bump core --- depthai-core | 2 +- src/pipeline/CommonBindings.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/depthai-core b/depthai-core index 98360b5c8..fad0a3106 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 98360b5c8bf30500fde14eff0da7c2aec4276d7a +Subproject commit fad0a3106f3b984d3a731677fdbea82158586fda diff --git a/src/pipeline/CommonBindings.cpp b/src/pipeline/CommonBindings.cpp index ae83051e8..5e03660d6 100644 --- a/src/pipeline/CommonBindings.cpp +++ b/src/pipeline/CommonBindings.cpp @@ -5,7 +5,7 @@ // depthai-shared #include "depthai-shared/common/CameraBoardSocket.hpp" -#include "depthai-shared/common/Connectivity.hpp" +#include "depthai-shared/common/ConnectionInterface.hpp" #include "depthai-shared/common/EepromData.hpp" #include "depthai-shared/common/CameraImageOrientation.hpp" #include "depthai-shared/common/CameraSensorType.hpp" @@ -41,7 +41,7 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack){ py::class_ point3f(m, "Point3f", DOC(dai, Point3f)); py::class_ size2f(m, "Size2f", DOC(dai, Size2f)); py::enum_ cameraBoardSocket(m, "CameraBoardSocket", DOC(dai, CameraBoardSocket)); - py::enum_ connectivity(m, "Connectivity", DOC(dai, Connectivity)); + py::enum_ connectionInterface(m, "connectionInterface", DOC(dai, ConnectionInterface)); py::enum_ cameraSensorType(m, "CameraSensorType", DOC(dai, CameraSensorType)); py::enum_ cameraImageOrientation(m, "CameraImageOrientation", DOC(dai, CameraImageOrientation)); py::class_ cameraSensorConfig(m, "CameraSensorConfig", DOC(dai, CameraSensorConfig)); @@ -185,11 +185,11 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack){ .value("TOF", CameraSensorType::TOF) .value("THERMAL", CameraSensorType::THERMAL) ; - // Connectivity enum bindings - connectivity - .value("USB", Connectivity::USB) - .value("ETHERNET", Connectivity::ETHERNET) - .value("WIFI", Connectivity::WIFI) + // ConnectionInterface enum bindings + connectionInterface + .value("USB", ConnectionInterface::USB) + .value("ETHERNET", ConnectionInterface::ETHERNET) + .value("WIFI", ConnectionInterface::WIFI) ; // CameraImageOrientation enum bindings cameraImageOrientation From 0243799b9aa7146deb23b76b523782a2faf2974b Mon Sep 17 00:00:00 2001 From: asahtik Date: Fri, 24 Nov 2023 09:18:20 +0100 Subject: [PATCH 081/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index a9a0b314a..bc067fa1a 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit a9a0b314a252d727e5a6fa875ee3e58cecef2e37 +Subproject commit bc067fa1aef94c01aaca125e23b4a245ef8756fd From 62bcbf60c308038290d743b204236bca663f98a8 Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 27 Nov 2023 16:09:45 +0100 Subject: [PATCH 082/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index fad0a3106..5229636d0 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit fad0a3106f3b984d3a731677fdbea82158586fda +Subproject commit 5229636d0d02f7b867eaabf03b4aead314b27545 From 0ee98937a29be60e30b9a74c204d3a5c1e0fadc7 Mon Sep 17 00:00:00 2001 From: asahtik Date: Mon, 27 Nov 2023 17:40:07 +0100 Subject: [PATCH 083/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 5229636d0..74384c5c9 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 5229636d0d02f7b867eaabf03b4aead314b27545 +Subproject commit 74384c5c9243a0e62289d21ffab2445675fd3521 From 88f6501fb8cff519e3856947f546eb07b41fd79d Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 29 Nov 2023 11:49:35 +0100 Subject: [PATCH 084/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index eaeab629d..943075390 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit eaeab629d6f374e23dead837d0e19b9555c2a102 +Subproject commit 943075390a6877b523aa6f10c54d75cbdd3ac97c From faa123c9b4502e38b09b56b94735468ebd23d7eb Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 29 Nov 2023 11:52:48 +0100 Subject: [PATCH 085/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 74384c5c9..a5b6cbb7b 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 74384c5c9243a0e62289d21ffab2445675fd3521 +Subproject commit a5b6cbb7b2d3cffea6cc873df37dedfd84b49873 From 0f64ce0ebddca87e963b20696dc95d002a2cd251 Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 29 Nov 2023 13:07:44 +0100 Subject: [PATCH 086/105] Changed crashdump timing --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 9ac7da346..6684f1458 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 9ac7da34666a5e16573300bb789e8713aaa3ab2e +Subproject commit 6684f1458852e7cc936c9a6c1b324efd03478b9e From 54d8702ec176ec8dfa42a2866af98078ed91521d Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 29 Nov 2023 13:21:52 +0100 Subject: [PATCH 087/105] Clangformat --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 6684f1458..29de45df9 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 6684f1458852e7cc936c9a6c1b324efd03478b9e +Subproject commit 29de45df9cf8d454f8e757cde6ff2ef940ac6258 From 78d6f171d5c735921c2dd7892bc995809b06691d Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 29 Nov 2023 14:59:27 +0100 Subject: [PATCH 088/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 29de45df9..1826431d6 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 29de45df9cf8d454f8e757cde6ff2ef940ac6258 +Subproject commit 1826431d61102ce650ee420100b81325454d22bc From 51b29904b4b2ed8322b85b12ddbb60ce23486ca6 Mon Sep 17 00:00:00 2001 From: moratom <47612463+moratom@users.noreply.github.com> Date: Thu, 30 Nov 2023 13:37:59 +0100 Subject: [PATCH 089/105] Fix a sync example --- examples/Sync/depth_video_synced.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Sync/depth_video_synced.py b/examples/Sync/depth_video_synced.py index f572facfe..bd1c85cef 100644 --- a/examples/Sync/depth_video_synced.py +++ b/examples/Sync/depth_video_synced.py @@ -18,7 +18,7 @@ monoLeft.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P) monoLeft.setCamera("left") monoRight.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P) -monoLeft.setCamera("right") +monoRight.setCamera("right") stereo.setDefaultProfilePreset(dai.node.StereoDepth.PresetMode.HIGH_ACCURACY) From 5c0a0ea19d426dd2301b336fd21d04f3f32c763d Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 30 Nov 2023 17:44:18 +0100 Subject: [PATCH 090/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 1826431d6..8d45d32a8 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 1826431d61102ce650ee420100b81325454d22bc +Subproject commit 8d45d32a89ec9138f60e18e18dd8f5246650d1fb From 2e7cd0ad90c402c1484a8647f96aff89b581500c Mon Sep 17 00:00:00 2001 From: asahtik Date: Tue, 5 Dec 2023 21:36:55 +0100 Subject: [PATCH 091/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 8d45d32a8..419cfd235 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 8d45d32a89ec9138f60e18e18dd8f5246650d1fb +Subproject commit 419cfd235d313e83e6b9013839447200b9f18ac0 From cfd8b18fa4e746606ce94712efb5159a811d8f2f Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 6 Dec 2023 16:18:31 +0100 Subject: [PATCH 092/105] Smoothe timesync with a running median --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 8d45d32a8..15c37de9f 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 8d45d32a89ec9138f60e18e18dd8f5246650d1fb +Subproject commit 15c37de9fef4f2a752178d233a2f048fc875cd1c From 4da7acb62bf2ce18b95ec8ca653ff00c1fd96038 Mon Sep 17 00:00:00 2001 From: asahtik Date: Wed, 6 Dec 2023 18:47:13 +0100 Subject: [PATCH 093/105] Bump core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 15c37de9f..9312944e1 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 15c37de9fef4f2a752178d233a2f048fc875cd1c +Subproject commit 9312944e1ed85591aebef57f61133cddc9a061dc From 56ef6d80c66a1096cbfa2fd5b6975a8aaf086f94 Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Thu, 7 Dec 2023 01:22:19 +0100 Subject: [PATCH 094/105] Add an example --- depthai-core | 2 +- examples/Sync/imu_video_synced.py | 59 +++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 examples/Sync/imu_video_synced.py diff --git a/depthai-core b/depthai-core index 419cfd235..ef06fd654 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 419cfd235d313e83e6b9013839447200b9f18ac0 +Subproject commit ef06fd6544440470f1d5c146ab4e2ec50c085031 diff --git a/examples/Sync/imu_video_synced.py b/examples/Sync/imu_video_synced.py new file mode 100644 index 000000000..7fbede660 --- /dev/null +++ b/examples/Sync/imu_video_synced.py @@ -0,0 +1,59 @@ +import depthai as dai +import numpy as np +import cv2 +from datetime import timedelta + +device = dai.Device() + +imuType = device.getConnectedIMU() +imuFirmwareVersion = device.getIMUFirmwareVersion() +print(f"IMU type: {imuType}, firmware version: {imuFirmwareVersion}") + +if imuType != "BNO086": + print("Rotation vector output is supported only by BNO086!") + exit(0) + +pipeline = dai.Pipeline() + +color = pipeline.create(dai.node.ColorCamera) +imu = pipeline.create(dai.node.IMU) +sync = pipeline.create(dai.node.Sync) +xoutImu = pipeline.create(dai.node.XLinkOut) +xoutImu.setStreamName("imu") + +xoutGrp = pipeline.create(dai.node.XLinkOut) +xoutGrp.setStreamName("xout") + +color.setCamera("color") + +imu.enableIMUSensor(dai.IMUSensor.ROTATION_VECTOR, 120) +imu.setBatchReportThreshold(1) +imu.setMaxBatchReports(10) + +sync.setSyncThreshold(timedelta(milliseconds=10)) +sync.setSyncAttempts(-1) + +color.video.link(sync.inputs["video"]) +imu.out.link(sync.inputs["imu"]) + +sync.out.link(xoutGrp.input) + + +with device: + device.startPipeline(pipeline) + groupQueue = device.getOutputQueue("xout", 3, True) + while True: + groupMessage = groupQueue.get() + imuMessage = groupMessage["imu"] + colorMessage = groupMessage["video"] + print() + print("Device timestamp imu: " + str(imuMessage.getTimestampDevice())) + print("Device timestamp video:" + str(colorMessage.getTimestampDevice())) + latestRotationVector = imuMessage.packets[-1].rotationVector + imuF = "{:.4f}" + print(f"Quaternion: i: {imuF.format(latestRotationVector.i)} j: {imuF.format(latestRotationVector.j)} " + f"k: {imuF.format(latestRotationVector.k)} real: {imuF.format(latestRotationVector.real)}") + print() + cv2.imshow("video", colorMessage.getCvFrame()) + if cv2.waitKey(1) == ord("q"): + break From 0af0fc77b6d2dd87ec51eec502cee7a300fbd181 Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Thu, 7 Dec 2023 01:48:00 +0100 Subject: [PATCH 095/105] [RVC2 FW] Update FW with depthai-shared develop --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index ef06fd654..d60e20338 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit ef06fd6544440470f1d5c146ab4e2ec50c085031 +Subproject commit d60e20338014ad1c401b903afe32a3ac3e0f7021 From dcb8febdb1e8c4bfce61d6c1658862151f8dc87e Mon Sep 17 00:00:00 2001 From: asahtik Date: Thu, 7 Dec 2023 09:28:59 +0100 Subject: [PATCH 096/105] Bump core (stability fix 1) --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 9312944e1..005bd45c1 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 9312944e1ed85591aebef57f61133cddc9a061dc +Subproject commit 005bd45c1e9b9ec4f4eda8a4c445a9022d9d76f3 From aa7e8fb989d9d3b0e2803988779f7dc129d02f2d Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Thu, 7 Dec 2023 15:56:24 +0100 Subject: [PATCH 097/105] Update core with stability fixes for timesyncing --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index d60e20338..00a5c5c32 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit d60e20338014ad1c401b903afe32a3ac3e0f7021 +Subproject commit 00a5c5c32cc2d2e4534ecda4fb0e1ae262c3806b From a4c687e0a38ce8852359adaf82f580b34954330f Mon Sep 17 00:00:00 2001 From: asahtik Date: Fri, 8 Dec 2023 13:03:37 +0100 Subject: [PATCH 098/105] Test of bl fix --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 8d45d32a8..e8e004862 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 8d45d32a89ec9138f60e18e18dd8f5246650d1fb +Subproject commit e8e004862c70516c1102ef40a86dbf7405e0e5c2 From 4c4991214deffdddb23536d11020f094e280bf52 Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Mon, 11 Dec 2023 01:45:14 +0100 Subject: [PATCH 099/105] Revert XLink profiling to uint64_t change --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 005bd45c1..5ca1e14ca 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 005bd45c1e9b9ec4f4eda8a4c445a9022d9d76f3 +Subproject commit 5ca1e14cafa22f975b29398ebd13416bd69ddc47 From aa4ec1063a0a10b1b95738389cda93bdfec6a45e Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Mon, 11 Dec 2023 11:52:32 +0100 Subject: [PATCH 100/105] Update depthai-core to develop --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 5ca1e14ca..0cae1b073 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 5ca1e14cafa22f975b29398ebd13416bd69ddc47 +Subproject commit 0cae1b0731568a788041fe423aaaa40a7162e74c From 0c00a67080825c8ec3fc9e62c1fc75a96e0bf332 Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Mon, 11 Dec 2023 15:55:03 +0100 Subject: [PATCH 101/105] Update core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index a8a470227..cf7e7e0c0 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit a8a470227ad798629609f088414153f7fc90b034 +Subproject commit cf7e7e0c0bbcb6cd50ddfb9f5902afa1998a23a1 From e50e92aad709e649673a01630b1bc1daa0d4586a Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Mon, 11 Dec 2023 20:50:36 +0100 Subject: [PATCH 102/105] Update core to develop --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index cf7e7e0c0..7930da4ea 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit cf7e7e0c0bbcb6cd50ddfb9f5902afa1998a23a1 +Subproject commit 7930da4ea455f1fa82e768f4ede581bafd10d9a8 From 24ad14e1892b9f40658aaf59d8c34ff88737aa38 Mon Sep 17 00:00:00 2001 From: Martin Peterlin Date: Wed, 13 Dec 2023 12:40:39 +0100 Subject: [PATCH 103/105] Modified libclang usage for readthedocs --- docs/source/conf.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 2fe38a392..c99a90c4c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -22,12 +22,13 @@ subprocess.check_call(['make', 'install'], cwd=tmpdir+'/libusb-1.0.24') env['PATH'] = tmpdir+'/libusb/include:'+tmpdir+'/libusb/lib'+':'+env['PATH'] -# libclang -subprocess.check_call(['wget', 'https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/misc/libclang-11_manylinux2014_x86_64.tar.xz'], cwd=tmpdir) -subprocess.check_call(['mkdir', '-p', 'libclang'], cwd=tmpdir) -subprocess.check_call(['tar', 'xf', 'libclang-11_manylinux2014_x86_64.tar.xz', '-C', tmpdir+'/libclang/'], cwd=tmpdir) -env['LIBCLANG_PATH'] = tmpdir+'/libclang/usr/lib/llvm-11/lib/libclang.so.1' -env['LLVM_DIR_PATH'] = tmpdir+'/libclang/usr/lib/llvm-11/' +# Not needed since libclang usage in pip requirements (brings its own library) +# # libclang +# subprocess.check_call(['wget', 'https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/misc/libclang-11_manylinux2014_x86_64.tar.xz'], cwd=tmpdir) +# subprocess.check_call(['mkdir', '-p', 'libclang'], cwd=tmpdir) +# subprocess.check_call(['tar', 'xf', 'libclang-11_manylinux2014_x86_64.tar.xz', '-C', tmpdir+'/libclang/'], cwd=tmpdir) +# env['LIBCLANG_PATH'] = tmpdir+'/libclang/usr/lib/llvm-11/lib/libclang.so.1' +# env['LLVM_DIR_PATH'] = tmpdir+'/libclang/usr/lib/llvm-11/' # Build library and generate actual conf.py subprocess.run(["cmake -P ../ci.cmake"], cwd=cwd, shell=True, check=True, env=env) From ead6377944c548757806fd48f1b5f44a36482797 Mon Sep 17 00:00:00 2001 From: Martin Peterlin Date: Wed, 13 Dec 2023 12:43:26 +0100 Subject: [PATCH 104/105] Bump version to 2.24.0.0 --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 7930da4ea..fc39d139d 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 7930da4ea455f1fa82e768f4ede581bafd10d9a8 +Subproject commit fc39d139db8fed8b76b760bf33a2c26930db4c6d From 9f21470136fed1f19df99e329d6ab57b9a921858 Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Wed, 13 Dec 2023 14:55:40 +0100 Subject: [PATCH 105/105] Update core to main --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index fc39d139d..6628488ef 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit fc39d139db8fed8b76b760bf33a2c26930db4c6d +Subproject commit 6628488ef8956f73f1c7bf4c8f1da218ad327a6f