From fe167fdffcd8a5abadb496a9a5211cd0fc1e2928 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Thu, 23 Sep 2021 20:45:13 +0300 Subject: [PATCH 01/19] Set fine tuned stereo settings --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index c282b5e47..8af5641c0 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit c282b5e479297ecae5e0154db9d712fa5d81e98d +Subproject commit 8af5641c0e0d91d89d84bd4de8daa5aceaebc658 From 794e27921329584dc1b61b9e2ad053a6d386cebd Mon Sep 17 00:00:00 2001 From: TheMarpe Date: Wed, 27 Oct 2021 00:33:27 +0200 Subject: [PATCH 02/19] Modified setBlobPath to accept any py object and try converting it to string --- src/pipeline/NodeBindings.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pipeline/NodeBindings.cpp b/src/pipeline/NodeBindings.cpp index 4dc374e33..62b596cce 100644 --- a/src/pipeline/NodeBindings.cpp +++ b/src/pipeline/NodeBindings.cpp @@ -626,7 +626,10 @@ void NodeBindings::bind(pybind11::module& m, void* pCallstack){ .def_readonly("input", &NeuralNetwork::input, DOC(dai, node, NeuralNetwork, input)) .def_readonly("out", &NeuralNetwork::out, DOC(dai, node, NeuralNetwork, out)) .def_readonly("passthrough", &NeuralNetwork::passthrough, DOC(dai, node, NeuralNetwork, passthrough)) - .def("setBlobPath", &NeuralNetwork::setBlobPath, py::arg("path"), DOC(dai, node, NeuralNetwork, setBlobPath)) + .def("setBlobPath", [](NeuralNetwork& nn, py::object obj){ + // Allows to call this function with paths as well as strings + nn.setBlobPath(py::str(obj)); + }, py::arg("path"), DOC(dai, node, NeuralNetwork, setBlobPath)) .def("setNumPoolFrames", &NeuralNetwork::setNumPoolFrames, py::arg("numFrames"), DOC(dai, node, NeuralNetwork, setNumPoolFrames)) .def("setNumInferenceThreads", &NeuralNetwork::setNumInferenceThreads, py::arg("numThreads"), DOC(dai, node, NeuralNetwork, setNumInferenceThreads)) .def("setNumNCEPerInferenceThread", &NeuralNetwork::setNumNCEPerInferenceThread, py::arg("numNCEPerThread"), DOC(dai, node, NeuralNetwork, setNumNCEPerInferenceThread)) From ce2d1c44657c6eae47cd510491a32dcca84967b4 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Fri, 29 Oct 2021 23:24:27 +0300 Subject: [PATCH 03/19] StereoDepth: Add extended disparity mode --- depthai-core | 2 +- examples/StereoDepth/stereo_depth_from_host.py | 5 +++++ examples/StereoDepth/stereo_depth_video.py | 0 src/DatatypeBindings.cpp | 6 ++++-- src/pipeline/NodeBindings.cpp | 1 - 5 files changed, 10 insertions(+), 4 deletions(-) mode change 100644 => 100755 examples/StereoDepth/stereo_depth_video.py diff --git a/depthai-core b/depthai-core index ab22fe50c..7622cef23 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit ab22fe50c6a9eec03783291ca6144b9330cb58f5 +Subproject commit 7622cef23773526711359ff8458529f1645331e9 diff --git a/examples/StereoDepth/stereo_depth_from_host.py b/examples/StereoDepth/stereo_depth_from_host.py index acd61c4fe..c3d215b4c 100755 --- a/examples/StereoDepth/stereo_depth_from_host.py +++ b/examples/StereoDepth/stereo_depth_from_host.py @@ -138,6 +138,11 @@ def handleKeypress(key, stereoDepthConfigInQueue): StereoConfigHandler.config.algorithmControl.enableSubpixel = not StereoConfigHandler.config.algorithmControl.enableSubpixel state = "on" if StereoConfigHandler.config.algorithmControl.enableSubpixel else "off" print(f"Subpixel {state}") + elif key == ord('3'): + StereoConfigHandler.newConfig = True + StereoConfigHandler.config.algorithmControl.enableExtended = not StereoConfigHandler.config.algorithmControl.enableExtended + state = "on" if StereoConfigHandler.config.algorithmControl.enableExtended else "off" + print(f"Extended {state}") StereoConfigHandler.sendConfig(stereoDepthConfigInQueue) diff --git a/examples/StereoDepth/stereo_depth_video.py b/examples/StereoDepth/stereo_depth_video.py old mode 100644 new mode 100755 diff --git a/src/DatatypeBindings.cpp b/src/DatatypeBindings.cpp index 37b347d7e..70d7f5748 100644 --- a/src/DatatypeBindings.cpp +++ b/src/DatatypeBindings.cpp @@ -1062,6 +1062,7 @@ void DatatypeBindings::bind(pybind11::module& m, void* pCallstack){ algorithmControl .def(py::init<>()) .def_readwrite("enableLeftRightCheck", &RawStereoDepthConfig::AlgorithmControl::enableLeftRightCheck, DOC(dai, RawStereoDepthConfig, AlgorithmControl, enableLeftRightCheck)) + .def_readwrite("enableExtended", &RawStereoDepthConfig::AlgorithmControl::enableExtended, DOC(dai, RawStereoDepthConfig, AlgorithmControl, enableExtended)) .def_readwrite("enableSubpixel", &RawStereoDepthConfig::AlgorithmControl::enableSubpixel, DOC(dai, RawStereoDepthConfig, AlgorithmControl, enableSubpixel)) .def_readwrite("leftRightCheckThreshold", &RawStereoDepthConfig::AlgorithmControl::leftRightCheckThreshold, DOC(dai, RawStereoDepthConfig, AlgorithmControl, leftRightCheckThreshold)) .def_readwrite("subpixelFractionalBits", &RawStereoDepthConfig::AlgorithmControl::subpixelFractionalBits, DOC(dai, RawStereoDepthConfig, AlgorithmControl, subpixelFractionalBits)) @@ -1141,8 +1142,9 @@ void DatatypeBindings::bind(pybind11::module& m, void* pCallstack){ .def("getMedianFilter", &StereoDepthConfig::getMedianFilter, DOC(dai, StereoDepthConfig, getMedianFilter)) .def("getBilateralFilterSigma", &StereoDepthConfig::getBilateralFilterSigma, DOC(dai, StereoDepthConfig, getBilateralFilterSigma)) .def("getLeftRightCheckThreshold", &StereoDepthConfig::getLeftRightCheckThreshold, DOC(dai, StereoDepthConfig, getLeftRightCheckThreshold)) - .def("setLeftRightCheck", &StereoDepthConfig::setLeftRightCheck, DOC(dai, StereoDepthConfig, setLeftRightCheck)) - .def("setSubpixel", &StereoDepthConfig::setSubpixel, DOC(dai, StereoDepthConfig, setSubpixel)) + .def("setLeftRightCheck", &StereoDepthConfig::setLeftRightCheck, py::arg("enable"), DOC(dai, StereoDepthConfig, setLeftRightCheck)) + .def("setExtendedDisparity", &StereoDepthConfig::setExtendedDisparity, py::arg("enable"), DOC(dai, StereoDepthConfig, setExtendedDisparity)) + .def("setSubpixel", &StereoDepthConfig::setSubpixel, py::arg("enable"), DOC(dai, StereoDepthConfig, setSubpixel)) .def("getMaxDisparity", &StereoDepthConfig::getMaxDisparity, DOC(dai, StereoDepthConfig, getMaxDisparity)) .def("set", &StereoDepthConfig::set, py::arg("config"), DOC(dai, StereoDepthConfig, set)) .def("get", &StereoDepthConfig::get, DOC(dai, StereoDepthConfig, get)) diff --git a/src/pipeline/NodeBindings.cpp b/src/pipeline/NodeBindings.cpp index 62b596cce..f653fcd28 100644 --- a/src/pipeline/NodeBindings.cpp +++ b/src/pipeline/NodeBindings.cpp @@ -283,7 +283,6 @@ void NodeBindings::bind(pybind11::module& m, void* pCallstack){ .def_readwrite("inputConfigSync", &StereoDepthProperties::inputConfigSync) .def_readwrite("depthAlign", &StereoDepthProperties::depthAlign) .def_readwrite("depthAlignCamera", &StereoDepthProperties::depthAlignCamera) - .def_readwrite("enableExtendedDisparity", &StereoDepthProperties::enableExtendedDisparity) .def_readwrite("rectifyEdgeFillColor", &StereoDepthProperties::rectifyEdgeFillColor) .def_readwrite("width", &StereoDepthProperties::width) .def_readwrite("height", &StereoDepthProperties::height) From b3635eb24990a03306aba853cbac7ad978aa8369 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Fri, 29 Oct 2021 23:24:43 +0300 Subject: [PATCH 04/19] Update core to latest develop --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 7622cef23..7c3049220 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 7622cef23773526711359ff8458529f1645331e9 +Subproject commit 7c304922069b0fb172f07043fdd465c3c88a46ba From 7e1542ebd37dbe3774d47c336d6b3721e976033c Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Sat, 30 Oct 2021 03:08:46 +0300 Subject: [PATCH 05/19] Add extended mode debug outputs --- depthai-core | 2 +- .../StereoDepth/stereo_depth_from_host.py | 57 +++++++++++++------ src/pipeline/NodeBindings.cpp | 2 + 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/depthai-core b/depthai-core index 7c3049220..c021c8f9e 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 7c304922069b0fb172f07043fdd465c3c88a46ba +Subproject commit c021c8f9e1e88bfb30ee2a3ee00ddc445597a46a diff --git a/examples/StereoDepth/stereo_depth_from_host.py b/examples/StereoDepth/stereo_depth_from_host.py index c3d215b4c..7623a6bb2 100755 --- a/examples/StereoDepth/stereo_depth_from_host.py +++ b/examples/StereoDepth/stereo_depth_from_host.py @@ -16,10 +16,6 @@ parser.add_argument('-dumpdispcost', "--dumpdisparitycostvalues", action="store_true", help="Dumps the disparity cost values for each disparity range. 96 byte for each pixel.") args = parser.parse_args() -if args.debug and args.dumpdisparitycostvalues: - print("-debug and --dumpdisparitycostvalues are mutually exclusive!") - exit(1) - if not Path(datasetDefault).exists(): import sys raise FileNotFoundError(f'Required file/s not found, please run "{sys.executable} install_requirements.py"') @@ -209,6 +205,8 @@ def __init__(self, config): if args.debug: xoutDebugLrCheckIt1 = pipeline.create(dai.node.XLinkOut) xoutDebugLrCheckIt2 = pipeline.create(dai.node.XLinkOut) + xoutDebugExtLrCheckIt1 = pipeline.create(dai.node.XLinkOut) + xoutDebugExtLrCheckIt2 = pipeline.create(dai.node.XLinkOut) if args.dumpdisparitycostvalues: xoutDebugCostDump = pipeline.create(dai.node.XLinkOut) @@ -227,6 +225,8 @@ def __init__(self, config): if args.debug: xoutDebugLrCheckIt1.setStreamName('disparity_lr_check_iteration1') xoutDebugLrCheckIt2.setStreamName('disparity_lr_check_iteration2') + xoutDebugExtLrCheckIt1.setStreamName('disparity_ext_lr_check_iteration1') + xoutDebugExtLrCheckIt2.setStreamName('disparity_ext_lr_check_iteration2') if args.dumpdisparitycostvalues: xoutDebugCostDump.setStreamName('disparity_cost_dump') @@ -258,6 +258,8 @@ def __init__(self, config): if args.debug: stereo.debugDispLrCheckIt1.link(xoutDebugLrCheckIt1.input) stereo.debugDispLrCheckIt2.link(xoutDebugLrCheckIt2.input) + stereo.debugExtDispLrCheckIt1.link(xoutDebugExtLrCheckIt1.input) + stereo.debugExtDispLrCheckIt2.link(xoutDebugExtLrCheckIt2.input) if args.dumpdisparitycostvalues: stereo.debugDispCostDump.link(xoutDebugCostDump.input) @@ -283,6 +285,7 @@ def __init__(self, config): debugStreams = [] if args.debug: debugStreams.extend(['disparity_lr_check_iteration1', 'disparity_lr_check_iteration2']) + debugStreams.extend(['disparity_ext_lr_check_iteration1', 'disparity_ext_lr_check_iteration2']) if args.dumpdisparitycostvalues: debugStreams.append('disparity_cost_dump') @@ -332,22 +335,17 @@ def convertToCv2Frame(name, image, config): # Create a receive queue for each stream q_list = [] - q_list_debug = [] for s in streams: q = device.getOutputQueue(s, 8, blocking=False) q_list.append(q) - if args.debug or args.dumpdisparitycostvalues: - q_list_debug = q_list.copy() - for s in debugStreams: - q = device.getOutputQueue(s, 8, blocking=False) - q_list_debug.append(q) inCfg = device.getOutputQueue("stereo_cfg", 8, blocking=False) # Need to set a timestamp for input frames, for the sync stage in Stereo node timestamp_ms = 0 index = 0 + prevQueues = q_list.copy() while True: # Handle input streams, if any if in_q_list: @@ -379,13 +377,38 @@ def convertToCv2Frame(name, image, config): currentConfig = inCfg.get() lrCheckEnabled = currentConfig.get().algorithmControl.enableLeftRightCheck - queues = q_list - - if (args.debug and lrCheckEnabled) or args.dumpdisparitycostvalues: - queues = q_list_debug - else: - for s in debugStreams: - cv2.destroyWindow(s) + extendedEnabled = currentConfig.get().algorithmControl.enableExtended + queues = q_list.copy() + + if args.dumpdisparitycostvalues: + q = device.getOutputQueue('disparity_cost_dump', 8, blocking=False) + queues.append(q) + + if args.debug: + q_list_debug = [] + + activeDebugStreams = [] + if lrCheckEnabled: + activeDebugStreams.extend(['disparity_lr_check_iteration1', 'disparity_lr_check_iteration2']) + if extendedEnabled: + activeDebugStreams.extend(['disparity_ext_lr_check_iteration1']) + if lrCheckEnabled: + activeDebugStreams.extend(['disparity_ext_lr_check_iteration2']) + + for s in activeDebugStreams: + q = device.getOutputQueue(s, 8, blocking=False) + q_list_debug.append(q) + + queues.extend(q_list_debug) + + def ListDiff(li1, li2): + return list(set(li1) - set(li2)) + list(set(li2) - set(li1)) + + diff = ListDiff(prevQueues, queues) + for s in diff: + name = s.getName() + cv2.destroyWindow(name) + prevQueues = queues.copy() for q in queues: if q.getName() in ['left', 'right']: continue diff --git a/src/pipeline/NodeBindings.cpp b/src/pipeline/NodeBindings.cpp index f653fcd28..10d258965 100644 --- a/src/pipeline/NodeBindings.cpp +++ b/src/pipeline/NodeBindings.cpp @@ -759,6 +759,8 @@ void NodeBindings::bind(pybind11::module& m, void* pCallstack){ .def_readonly("outConfig", &StereoDepth::outConfig, DOC(dai, node, StereoDepth, outConfig)) .def_readonly("debugDispLrCheckIt1", &StereoDepth::debugDispLrCheckIt1, DOC(dai, node, StereoDepth, debugDispLrCheckIt1)) .def_readonly("debugDispLrCheckIt2", &StereoDepth::debugDispLrCheckIt2, DOC(dai, node, StereoDepth, debugDispLrCheckIt2)) + .def_readonly("debugExtDispLrCheckIt1", &StereoDepth::debugExtDispLrCheckIt1, DOC(dai, node, StereoDepth, debugExtDispLrCheckIt1)) + .def_readonly("debugExtDispLrCheckIt2", &StereoDepth::debugExtDispLrCheckIt2, DOC(dai, node, StereoDepth, debugExtDispLrCheckIt2)) .def_readonly("debugDispCostDump", &StereoDepth::debugDispCostDump, DOC(dai, node, StereoDepth, debugDispCostDump)) .def_readonly("confidenceMap", &StereoDepth::confidenceMap, DOC(dai, node, StereoDepth, confidenceMap)) #if 0 //will be enabled when confidence map RGB aligment/LR-check support will be added From 3962d07e684a87ed0411bdee8813faa9d60b975f Mon Sep 17 00:00:00 2001 From: TheMarpe Date: Wed, 3 Nov 2021 00:41:25 +0100 Subject: [PATCH 06/19] Updated core - FW fixes --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index ab22fe50c..98e13c737 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit ab22fe50c6a9eec03783291ca6144b9330cb58f5 +Subproject commit 98e13c7377b051317f774898de31051bdea61f3c From 5797c2c0cf54f43aceaf0ddd4862ee44edc378ec Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Wed, 3 Nov 2021 04:36:07 +0200 Subject: [PATCH 07/19] Update core --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index c021c8f9e..e0565e752 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit c021c8f9e1e88bfb30ee2a3ee00ddc445597a46a +Subproject commit e0565e75298a8db5160163025ffb5b11b818ca97 From a7f79dd6e562288031cac23c59ef3abf85113340 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Thu, 4 Nov 2021 04:59:46 +0200 Subject: [PATCH 08/19] Add feature tracker on color example; update to latest core develop --- depthai-core | 2 +- examples/CMakeLists.txt | 1 + .../FeatureTracker/feature_tracker_color.py | 149 ++++++++++++++++++ 3 files changed, 151 insertions(+), 1 deletion(-) create mode 100755 examples/FeatureTracker/feature_tracker_color.py diff --git a/depthai-core b/depthai-core index e0565e752..9e60bf163 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit e0565e75298a8db5160163025ffb5b11b818ca97 +Subproject commit 9e60bf163e88a276958692d60186c22c63384ae3 diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 14ad288a4..7603084c5 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -109,6 +109,7 @@ add_python_example(edge_detector EdgeDetector/edge_detector.py) ## FeatureTracker add_python_example(feature_tracker FeatureTracker/feature_tracker.py) +add_python_example(feature_tracker_color FeatureTracker/feature_tracker_color.py) add_python_example(feature_detector FeatureTracker/feature_detector.py) ## HostSide diff --git a/examples/FeatureTracker/feature_tracker_color.py b/examples/FeatureTracker/feature_tracker_color.py new file mode 100755 index 000000000..6c03e7e4e --- /dev/null +++ b/examples/FeatureTracker/feature_tracker_color.py @@ -0,0 +1,149 @@ +#!/usr/bin/env python3 + +import cv2 +import depthai as dai +from collections import deque + +class FeatureTrackerDrawer: + + lineColor = (200, 0, 200) + pointColor = (0, 0, 255) + circleRadius = 2 + maxTrackedFeaturesPathLength = 30 + # for how many frames the feature is tracked + trackedFeaturesPathLength = 10 + + trackedIDs = None + trackedFeaturesPath = None + + def onTrackBar(self, val): + FeatureTrackerDrawer.trackedFeaturesPathLength = val + pass + + def trackFeaturePath(self, features): + + newTrackedIDs = set() + for currentFeature in features: + currentID = currentFeature.id + newTrackedIDs.add(currentID) + + if currentID not in self.trackedFeaturesPath: + self.trackedFeaturesPath[currentID] = deque() + + path = self.trackedFeaturesPath[currentID] + + path.append(currentFeature.position) + while(len(path) > max(1, FeatureTrackerDrawer.trackedFeaturesPathLength)): + path.popleft() + + self.trackedFeaturesPath[currentID] = path + + featuresToRemove = set() + for oldId in self.trackedIDs: + if oldId not in newTrackedIDs: + featuresToRemove.add(oldId) + + for id in featuresToRemove: + self.trackedFeaturesPath.pop(id) + + self.trackedIDs = newTrackedIDs + + def drawFeatures(self, img): + + cv2.setTrackbarPos(self.trackbarName, self.windowName, FeatureTrackerDrawer.trackedFeaturesPathLength) + + for featurePath in self.trackedFeaturesPath.values(): + path = featurePath + + for j in range(len(path) - 1): + src = (int(path[j].x), int(path[j].y)) + dst = (int(path[j + 1].x), int(path[j + 1].y)) + cv2.line(img, src, dst, self.lineColor, 1, cv2.LINE_AA, 0) + j = len(path) - 1 + cv2.circle(img, (int(path[j].x), int(path[j].y)), self.circleRadius, self.pointColor, -1, cv2.LINE_AA, 0) + + def __init__(self, trackbarName, windowName): + self.trackbarName = trackbarName + self.windowName = windowName + cv2.namedWindow(windowName) + cv2.createTrackbar(trackbarName, windowName, FeatureTrackerDrawer.trackedFeaturesPathLength, FeatureTrackerDrawer.maxTrackedFeaturesPathLength, self.onTrackBar) + self.trackedIDs = set() + self.trackedFeaturesPath = dict() + + +# Create pipeline +pipeline = dai.Pipeline() + +# Define sources and outputs +colorCam = pipeline.create(dai.node.ColorCamera) +featureTrackerColor = pipeline.create(dai.node.FeatureTracker) + +xoutPassthroughFrameColor = pipeline.create(dai.node.XLinkOut) +xoutTrackedFeaturesColor = pipeline.create(dai.node.XLinkOut) +xinTrackedFeaturesConfig = pipeline.create(dai.node.XLinkIn) + +xoutPassthroughFrameColor.setStreamName("passthroughFrameColor") +xoutTrackedFeaturesColor.setStreamName("trackedFeaturesColor") +xinTrackedFeaturesConfig.setStreamName("trackedFeaturesConfig") + +# Properties +colorCam.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P) + +if 1: + colorCam.setIspScale(2,3) + colorCam.video.link(featureTrackerColor.inputImage) +else: + colorCam.isp.link(featureTrackerColor.inputImage) + +# Linking +featureTrackerColor.passthroughInputImage.link(xoutPassthroughFrameColor.input) +featureTrackerColor.outputFeatures.link(xoutTrackedFeaturesColor.input) +xinTrackedFeaturesConfig.out.link(featureTrackerColor.inputConfig) + +# By default the least mount of resources are allocated +# increasing it improves performance +numShaves = 2 +numMemorySlices = 2 +featureTrackerColor.setHardwareResources(numShaves, numMemorySlices) +featureTrackerConfig = featureTrackerColor.initialConfig.get() + +print("Press 's' to switch between Lucas-Kanade optical flow and hardware accelerated motion estimation!") + +# Connect to device and start pipeline +with dai.Device(pipeline) as device: + + # Output queues used to receive the results + passthroughImageColorQueue = device.getOutputQueue("passthroughFrameColor", 8, False) + outputFeaturesColorQueue = device.getOutputQueue("trackedFeaturesColor", 8, False) + + inputFeatureTrackerConfigQueue = device.getInputQueue("trackedFeaturesConfig") + + colorWindowName = "color" + colorFeatureDrawer = FeatureTrackerDrawer("Feature tracking duration (frames)", colorWindowName) + + while True: + inPassthroughFrameColor = passthroughImageColorQueue.get() + passthroughFrameColor = inPassthroughFrameColor.getCvFrame() + colorFrame = passthroughFrameColor + + trackedFeaturesColor = outputFeaturesColorQueue.get().trackedFeatures + colorFeatureDrawer.trackFeaturePath(trackedFeaturesColor) + colorFeatureDrawer.drawFeatures(colorFrame) + + # Show the frame + cv2.imshow(colorWindowName, colorFrame) + + key = cv2.waitKey(1) + if key == ord('q'): + break + elif key == ord('s'): + if featureTrackerConfig.motionEstimator.type == dai.FeatureTrackerConfig.MotionEstimator.Type.LUCAS_KANADE_OPTICAL_FLOW: + featureTrackerConfig.motionEstimator.type = dai.FeatureTrackerConfig.MotionEstimator.Type.HW_MOTION_ESTIMATION + print("Switching to hardware accelerated motion estimation") + else: + featureTrackerConfig.motionEstimator.type = dai.FeatureTrackerConfig.MotionEstimator.Type.LUCAS_KANADE_OPTICAL_FLOW + print("Switching to Lucas-Kanade optical flow") + + cfg = dai.FeatureTrackerConfig() + cfg.set(featureTrackerConfig) + inputFeatureTrackerConfigQueue.send(cfg) From 660416177810a0a37e52deb8663481c17c09d391 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Thu, 4 Nov 2021 05:13:40 +0200 Subject: [PATCH 09/19] Add comments about extended mode control --- examples/StereoDepth/stereo_depth_from_host.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/StereoDepth/stereo_depth_from_host.py b/examples/StereoDepth/stereo_depth_from_host.py index 7623a6bb2..b667654a0 100755 --- a/examples/StereoDepth/stereo_depth_from_host.py +++ b/examples/StereoDepth/stereo_depth_from_host.py @@ -167,6 +167,7 @@ def __init__(self, config): print("Control census transform mean mode using the 'v' key.") print("Control left-right check mode using the '1' key.") print("Control subpixel mode using the '2' key.") + print("Control extended mode using the '3' key.") StereoConfigHandler.config = config From e96993e12881652475c071f7acf4fed725226bd5 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Thu, 4 Nov 2021 05:16:30 +0200 Subject: [PATCH 10/19] Make python scripts executable --- examples/ColorCamera/rgb_scene.py | 0 examples/ImageManip/image_manip_rotate.py | 0 examples/ImageManip/image_manip_tiling.py | 0 examples/Script/script_camera_control.py | 0 examples/Script/script_get_ip.py | 0 examples/Script/script_http_client.py | 0 examples/Script/script_http_server.py | 0 examples/Script/script_mjpeg_server.py | 0 examples/Script/script_nndata_example.py | 0 9 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 examples/ColorCamera/rgb_scene.py mode change 100644 => 100755 examples/ImageManip/image_manip_rotate.py mode change 100644 => 100755 examples/ImageManip/image_manip_tiling.py mode change 100644 => 100755 examples/Script/script_camera_control.py mode change 100644 => 100755 examples/Script/script_get_ip.py mode change 100644 => 100755 examples/Script/script_http_client.py mode change 100644 => 100755 examples/Script/script_http_server.py mode change 100644 => 100755 examples/Script/script_mjpeg_server.py mode change 100644 => 100755 examples/Script/script_nndata_example.py diff --git a/examples/ColorCamera/rgb_scene.py b/examples/ColorCamera/rgb_scene.py old mode 100644 new mode 100755 diff --git a/examples/ImageManip/image_manip_rotate.py b/examples/ImageManip/image_manip_rotate.py old mode 100644 new mode 100755 diff --git a/examples/ImageManip/image_manip_tiling.py b/examples/ImageManip/image_manip_tiling.py old mode 100644 new mode 100755 diff --git a/examples/Script/script_camera_control.py b/examples/Script/script_camera_control.py old mode 100644 new mode 100755 diff --git a/examples/Script/script_get_ip.py b/examples/Script/script_get_ip.py old mode 100644 new mode 100755 diff --git a/examples/Script/script_http_client.py b/examples/Script/script_http_client.py old mode 100644 new mode 100755 diff --git a/examples/Script/script_http_server.py b/examples/Script/script_http_server.py old mode 100644 new mode 100755 diff --git a/examples/Script/script_mjpeg_server.py b/examples/Script/script_mjpeg_server.py old mode 100644 new mode 100755 diff --git a/examples/Script/script_nndata_example.py b/examples/Script/script_nndata_example.py old mode 100644 new mode 100755 From 2e4848fa2e2e92d826aeea24907b739f838a9861 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Fri, 5 Nov 2021 19:42:05 +0200 Subject: [PATCH 11/19] Add fine tuned stereo settings, configurable P1/P2 cost aggregation parameters --- depthai-core | 2 +- examples/StereoDepth/stereo_depth_from_host.py | 16 ++++++++++++++++ src/DatatypeBindings.cpp | 6 ++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/depthai-core b/depthai-core index 8af5641c0..1b427f21b 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 8af5641c0e0d91d89d84bd4de8daa5aceaebc658 +Subproject commit 1b427f21bf26504426efa0437aabb2b5103bdd06 diff --git a/examples/StereoDepth/stereo_depth_from_host.py b/examples/StereoDepth/stereo_depth_from_host.py index 52bc7f0ea..454f2bd2d 100755 --- a/examples/StereoDepth/stereo_depth_from_host.py +++ b/examples/StereoDepth/stereo_depth_from_host.py @@ -50,6 +50,8 @@ def set(self, value): trLineqAlpha = list() trLineqBeta = list() trLineqThreshold = list() + trCostAggregationP1 = list() + trCostAggregationP2 = list() def trackbarSigma(value): StereoConfigHandler.config.postProcessing.bilateralSigmaValue = value @@ -92,6 +94,18 @@ def trackbarLineqThreshold(value): for tr in StereoConfigHandler.trLineqThreshold: tr.set(value) + def trackbarCostAggregationP1(value): + StereoConfigHandler.config.costAggregation.horizontalPenaltyCostP1 = value + StereoConfigHandler.newConfig = True + for tr in StereoConfigHandler.trCostAggregationP1: + tr.set(value) + + def trackbarCostAggregationP2(value): + StereoConfigHandler.config.costAggregation.horizontalPenaltyCostP2 = value + StereoConfigHandler.newConfig = True + for tr in StereoConfigHandler.trCostAggregationP2: + tr.set(value) + def handleKeypress(key, stereoDepthConfigInQueue): if key == ord('m'): StereoConfigHandler.newConfig = True @@ -158,6 +172,8 @@ def registerWindow(stream): StereoConfigHandler.trLineqAlpha.append(StereoConfigHandler.Trackbar('Linear equation alpha', stream, 0, 15, StereoConfigHandler.config.costMatching.linearEquationParameters.alpha, StereoConfigHandler.trackbarLineqAlpha)) StereoConfigHandler.trLineqBeta.append(StereoConfigHandler.Trackbar('Linear equation beta', stream, 0, 15, StereoConfigHandler.config.costMatching.linearEquationParameters.beta, StereoConfigHandler.trackbarLineqBeta)) StereoConfigHandler.trLineqThreshold.append(StereoConfigHandler.Trackbar('Linear equation threshold', stream, 0, 255, StereoConfigHandler.config.costMatching.linearEquationParameters.threshold, StereoConfigHandler.trackbarLineqThreshold)) + StereoConfigHandler.trCostAggregationP1.append(StereoConfigHandler.Trackbar('Cost aggregation P1', stream, 0, 500, StereoConfigHandler.config.costAggregation.horizontalPenaltyCostP1, StereoConfigHandler.trackbarCostAggregationP1)) + StereoConfigHandler.trCostAggregationP2.append(StereoConfigHandler.Trackbar('Cost aggregation P2', stream, 0, 500, StereoConfigHandler.config.costAggregation.horizontalPenaltyCostP2, StereoConfigHandler.trackbarCostAggregationP2)) def __init__(self, config): print("Control median filter using the 'm' key.") diff --git a/src/DatatypeBindings.cpp b/src/DatatypeBindings.cpp index 70d7f5748..b74ff3a01 100644 --- a/src/DatatypeBindings.cpp +++ b/src/DatatypeBindings.cpp @@ -1115,8 +1115,10 @@ void DatatypeBindings::bind(pybind11::module& m, void* pCallstack){ costAggregation .def(py::init<>()) .def_readwrite("divisionFactor", &RawStereoDepthConfig::CostAggregation::divisionFactor, DOC(dai, RawStereoDepthConfig, CostAggregation, divisionFactor)) - .def_readwrite("horizontalPenaltyCosts", &RawStereoDepthConfig::CostAggregation::horizontalPenaltyCosts, DOC(dai, RawStereoDepthConfig, CostAggregation, horizontalPenaltyCosts)) - .def_readwrite("verticalPenaltyCosts", &RawStereoDepthConfig::CostAggregation::verticalPenaltyCosts, DOC(dai, RawStereoDepthConfig, CostAggregation, verticalPenaltyCosts)) + .def_readwrite("horizontalPenaltyCostP1", &RawStereoDepthConfig::CostAggregation::horizontalPenaltyCostP1, DOC(dai, RawStereoDepthConfig, CostAggregation, horizontalPenaltyCostP1)) + .def_readwrite("horizontalPenaltyCostP2", &RawStereoDepthConfig::CostAggregation::horizontalPenaltyCostP2, DOC(dai, RawStereoDepthConfig, CostAggregation, horizontalPenaltyCostP2)) + .def_readwrite("verticalPenaltyCostP1", &RawStereoDepthConfig::CostAggregation::verticalPenaltyCostP1, DOC(dai, RawStereoDepthConfig, CostAggregation, verticalPenaltyCostP1)) + .def_readwrite("verticalPenaltyCostP2", &RawStereoDepthConfig::CostAggregation::verticalPenaltyCostP2, DOC(dai, RawStereoDepthConfig, CostAggregation, verticalPenaltyCostP2)) ; rawStereoDepthConfig From 35fd1cfa46ec15068e99b59dc6c509c9d8a93245 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Fri, 5 Nov 2021 23:14:55 +0200 Subject: [PATCH 12/19] Increase LR-check threshold to 10; disparity confidence threshold to 245 by default --- depthai-core | 2 +- examples/StereoDepth/stereo_depth_from_host.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 1b427f21b..3e8acdf88 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 1b427f21bf26504426efa0437aabb2b5103bdd06 +Subproject commit 3e8acdf8806d9f33f9881b18688c44d42f65c28d diff --git a/examples/StereoDepth/stereo_depth_from_host.py b/examples/StereoDepth/stereo_depth_from_host.py index 454f2bd2d..b9a10424e 100755 --- a/examples/StereoDepth/stereo_depth_from_host.py +++ b/examples/StereoDepth/stereo_depth_from_host.py @@ -96,12 +96,14 @@ def trackbarLineqThreshold(value): def trackbarCostAggregationP1(value): StereoConfigHandler.config.costAggregation.horizontalPenaltyCostP1 = value + StereoConfigHandler.config.costAggregation.verticalPenaltyCostP1 = value StereoConfigHandler.newConfig = True for tr in StereoConfigHandler.trCostAggregationP1: tr.set(value) def trackbarCostAggregationP2(value): StereoConfigHandler.config.costAggregation.horizontalPenaltyCostP2 = value + StereoConfigHandler.config.costAggregation.verticalPenaltyCostP2 = value StereoConfigHandler.newConfig = True for tr in StereoConfigHandler.trCostAggregationP2: tr.set(value) From 7498afce36f34dae5482c2bbf42db317e3e53dd5 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Sun, 7 Nov 2021 18:53:15 +0200 Subject: [PATCH 13/19] Update FW with Script node (DynamicPool) related fixes --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 3e8acdf88..6754cbb28 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 3e8acdf8806d9f33f9881b18688c44d42f65c28d +Subproject commit 6754cbb282144302ee05dfd27091814846e7b9f1 From 64bbd63479976970ad7fc42822f1f1356af30fd5 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Sun, 7 Nov 2021 23:40:27 +0200 Subject: [PATCH 14/19] Add support for non-square YOLO output --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 6754cbb28..3837fee4b 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 6754cbb282144302ee05dfd27091814846e7b9f1 +Subproject commit 3837fee4b2ec2253ec8429b4362d31fb430e6607 From 58812e41cbb80d6f06ddb100259d093abda664da Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Sun, 7 Nov 2021 23:46:32 +0200 Subject: [PATCH 15/19] Update FW with error reporting for DetectionNetwork --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 3837fee4b..630b461b5 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 3837fee4b2ec2253ec8429b4362d31fb430e6607 +Subproject commit 630b461b5c14085862c020020e352ce49c98e56a From 189527a535bea2bf44f3b9d9e2ec8266043fc10d Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Mon, 8 Nov 2021 01:21:37 +0200 Subject: [PATCH 16/19] Update core to latest develop --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 630b461b5..0465f5ef0 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 630b461b5c14085862c020020e352ce49c98e56a +Subproject commit 0465f5ef00d84e3a436ab60756ae4f0c0bf39032 From 4870b61ed90f405bd1eb12612c835906258c5779 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Thu, 11 Nov 2021 08:51:11 +0200 Subject: [PATCH 17/19] Fixes for object tracker; support for KCF and imageless short term tracking algorithms --- depthai-core | 2 +- src/pipeline/NodeBindings.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/depthai-core b/depthai-core index 0465f5ef0..4df2c68f6 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 0465f5ef00d84e3a436ab60756ae4f0c0bf39032 +Subproject commit 4df2c68f6bd79a9a0a5e09096e272d1634cc1ec7 diff --git a/src/pipeline/NodeBindings.cpp b/src/pipeline/NodeBindings.cpp index c3055d831..44dc85a44 100644 --- a/src/pipeline/NodeBindings.cpp +++ b/src/pipeline/NodeBindings.cpp @@ -359,8 +359,10 @@ void NodeBindings::bind(pybind11::module& m, void* pCallstack){ trackerType - .value("ZERO_TERM_IMAGELESS", TrackerType::ZERO_TERM_IMAGELESS) - .value("ZERO_TERM_COLOR_HISTOGRAM", TrackerType::ZERO_TERM_COLOR_HISTOGRAM) + .value("SHORT_TERM_KCF", TrackerType::SHORT_TERM_KCF, DOC(dai, TrackerType, SHORT_TERM_KCF)) + .value("SHORT_TERM_IMAGELESS", TrackerType::SHORT_TERM_IMAGELESS, DOC(dai, TrackerType, SHORT_TERM_IMAGELESS)) + .value("ZERO_TERM_IMAGELESS", TrackerType::ZERO_TERM_IMAGELESS, DOC(dai, TrackerType, ZERO_TERM_IMAGELESS)) + .value("ZERO_TERM_COLOR_HISTOGRAM", TrackerType::ZERO_TERM_COLOR_HISTOGRAM, DOC(dai, TrackerType, ZERO_TERM_COLOR_HISTOGRAM)) ; trackerIdAssigmentPolicy From c992c414ee4fb11d94a4cd7f22c9800b245290c6 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Fri, 12 Nov 2021 03:45:19 +0200 Subject: [PATCH 18/19] Update core to latest develop --- depthai-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depthai-core b/depthai-core index 4df2c68f6..23d7d4446 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 4df2c68f6bd79a9a0a5e09096e272d1634cc1ec7 +Subproject commit 23d7d444674927f20db78737f8f82d4f2d508b6f From 25feadfab738316067192eced4d36a106b6fc929 Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Sat, 13 Nov 2021 03:12:32 +0200 Subject: [PATCH 19/19] Release v2.12.0.0 --- CMakeLists.txt | 2 +- depthai-core | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bd6e8e18..a94ad9e06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ endif() # Pybindings project set(TARGET_NAME depthai) -project(depthai VERSION "1") # revision of bindings [depthai-core].[rev] +project(depthai VERSION "0") # revision of bindings [depthai-core].[rev] # Set default build type depending on context set(default_build_type "Release") diff --git a/depthai-core b/depthai-core index 23d7d4446..5a5b2f0ae 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 23d7d444674927f20db78737f8f82d4f2d508b6f +Subproject commit 5a5b2f0ae279dc82cdd93da371751c1c5a208afe