Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
0cadb24
WIP: Device configuration
themarpe May 15, 2021
2325f80
Fixed wrong bindings
themarpe May 16, 2021
589c4e3
Merge branch 'develop' into device_config
themarpe May 18, 2021
cf3599b
Updated example to showcase UsbSpeed settings
themarpe May 20, 2021
a219530
Removed bootloader configuration
themarpe May 21, 2021
64d7e87
Merge branch 'develop' into device_config
themarpe May 28, 2021
0d9e38d
Updated rgb_preview example
themarpe May 28, 2021
4e90bc9
Merge branch 'develop' into device_config
themarpe May 31, 2021
3449709
Merge branch 'develop' into device_config
themarpe Jul 21, 2021
1471626
Updated bindings for PrebootConfig
themarpe Jul 22, 2021
f0393ac
Merge branch 'develop' into device_config
themarpe Jul 24, 2021
c195c80
Added missing bindings
themarpe Jul 24, 2021
8ffab27
Updated core
themarpe Jul 27, 2021
acad905
Partially revert f6173f9, add back flash_bootloader.py
alex-luxonis Jul 23, 2021
b0410e9
Update core/bootloader
alex-luxonis Jul 28, 2021
147a2df
Updated flash_bootloader example
themarpe Jul 29, 2021
9420ab7
Updated core
themarpe Jul 29, 2021
1ef8c17
Merge branch 'develop' into scripting_gpio_interrupts
themarpe Jul 30, 2021
ab1b6a6
Added documentation of new Script GPIO API
themarpe Jul 30, 2021
c31e9f8
Updated core
themarpe Jul 30, 2021
3fff9f2
Updated core with SPI speed improvements
themarpe Aug 3, 2021
d5d8c03
Merge branch 'develop' into bootloader_updates
themarpe Aug 4, 2021
5992be8
Updated core and flash_bootloader example typo
themarpe Aug 4, 2021
1f1208a
Merge branch 'develop' into bootloader_updates
themarpe Aug 13, 2021
d2abf73
Bindings for nicer errors
kunaltyagi Aug 16, 2021
49cea8a
Bump for the submodule
kunaltyagi Aug 17, 2021
268c399
Le Bump
kunaltyagi Aug 17, 2021
20119ef
Update FW with stereo LR-check, subpixel fixes; extended mode is not …
SzabolcsGergely Aug 19, 2021
411f767
Temporary: Enable LR-check + subpixel in examples
SzabolcsGergely Aug 19, 2021
3a4139e
Update FW with stereo LR-check, subpixel fixes; extended mode is not …
SzabolcsGergely Aug 19, 2021
dbd7e48
Updated flash_bootloader.py example
themarpe Aug 17, 2021
e53ca51
Added bindings for DeviceBootloader Config
themarpe Aug 21, 2021
39871af
Updated flash_bootloader example
themarpe Aug 21, 2021
34d2993
Updated bindings and example name
themarpe Aug 23, 2021
dde13ab
Updated core
themarpe Aug 23, 2021
cb17db2
Updated core
themarpe Aug 23, 2021
9b4b3af
Registered XLink exceptions
themarpe Aug 24, 2021
c071935
Added initial testing infrastructure for bindings
themarpe Aug 24, 2021
7c9d4bb
Merge branch 'bootloader_updates' into develop_embedded
themarpe Aug 24, 2021
0c037d8
Merge branch 'device_config' into develop_embedded
themarpe Aug 24, 2021
ebabd54
Added bindings for bootBootloader
themarpe Aug 24, 2021
4efb10f
Merge branch 'throw.nice' into develop
themarpe Aug 25, 2021
b591e25
Updated core
themarpe Aug 25, 2021
f9ec223
Fixed incorrect constructors for DeviceBase
themarpe Aug 26, 2021
98a61ef
Merge branch 'scripting_gpio_interrupts' into develop_embedded
themarpe Aug 26, 2021
da57c1b
Updated core
themarpe Aug 26, 2021
d30eb94
Added bindings
Erol444 Aug 31, 2021
ab3dc9f
Fixed bindings DOC
Erol444 Sep 1, 2021
fca22ae
Updated depthai-core after merging PR
Erol444 Sep 1, 2021
7f4345a
Merge pull request #358 from luxonis/overloading_functions
Erol444 Sep 1, 2021
39b7743
Merge remote-tracking branch 'origin/develop' into HEAD
SzabolcsGergely Sep 1, 2021
2ace2ca
Updated core
themarpe Sep 2, 2021
cbee9c3
Added capability to not install signal handlers
themarpe Sep 2, 2021
8da445c
Updated core with unlimited number of connections
themarpe Sep 6, 2021
751e0d7
Added bindings for calibData and imageManipConfig
Erol444 Sep 6, 2021
29fb455
Merge pull request #362 from luxonis/bindings_helper_functions
Erol444 Sep 6, 2021
95d7366
Update core/FW, fix camera image orientation for OAK-1-PoE, was rotated
alex-luxonis Sep 5, 2021
7a0749a
Update core/FW, to fix CI build
alex-luxonis Sep 6, 2021
57b0e5b
Updated core
themarpe Sep 6, 2021
8cf7677
Merge remote-tracking branch 'origin/develop' into HEAD
SzabolcsGergely Sep 6, 2021
3816d09
Update core w/ Stereo improvements
SzabolcsGergely Sep 6, 2021
0013296
Merge branch 'develop_embedded' into develop
themarpe Sep 6, 2021
da39a0d
Remove python 3.5 wheels (#253)
SzabolcsGergely Sep 7, 2021
23c371e
Updated core
themarpe Sep 7, 2021
8f00026
Updated core
themarpe Sep 8, 2021
8b543d5
Merge remote-tracking branch 'origin/develop' into HEAD
SzabolcsGergely Sep 9, 2021
a181ef8
Update FW with stereo performance improvements
SzabolcsGergely Sep 9, 2021
5c73d4b
Update core
SzabolcsGergely Sep 9, 2021
ed2ca71
Imu extrinsics (#368)
saching13 Sep 17, 2021
f568bc9
Update FW, enable runtime configuration of Stereo node
SzabolcsGergely Sep 17, 2021
bb1b5b7
Refactor stereo depth config structure
SzabolcsGergely Sep 17, 2021
5ca88e0
Update core with subpixel fix
SzabolcsGergely Sep 17, 2021
777d835
Merge remote-tracking branch 'origin/develop' into HEAD
SzabolcsGergely Sep 17, 2021
cb59130
Add option to pick spatial calculation algorithm : average,min,max of…
SzabolcsGergely Sep 17, 2021
1f9c8ea
Add python bindings for spatial detection node
SzabolcsGergely Sep 18, 2021
cf2748c
Set bytes per pixel for ImgFrame
SzabolcsGergely Sep 18, 2021
57c2e31
Update core to match depthai-shared
SzabolcsGergely Sep 18, 2021
6093aed
Fix/update flash_bootloader example. Changes mirrored from C++ side:
alex-luxonis Sep 18, 2021
5f60685
Update core w/ CI fixes
SzabolcsGergely Sep 18, 2021
3f68e53
Merge pull request #371 from luxonis/flash_bl_example_fix
alex-luxonis Sep 18, 2021
6edb328
Merge remote-tracking branch 'origin/develop' into spatial_calc_algo_…
SzabolcsGergely Sep 18, 2021
4ca7c02
Update core to latest develop
SzabolcsGergely Sep 18, 2021
2c76ed3
Merge pull request #370 from luxonis/spatial_calc_algo_choice
SzabolcsGergely Sep 18, 2021
0fc087c
Merge remote-tracking branch 'origin/develop' into HEAD
SzabolcsGergely Sep 18, 2021
b9f9ff0
Add debug outputs to stereo node; expose number of frame pools
SzabolcsGergely Sep 19, 2021
ddb2774
Add stereo node output config
SzabolcsGergely Sep 20, 2021
d17d5c4
Add getMaxDisparity bindings
SzabolcsGergely Sep 20, 2021
7d99d2b
Improve deprecation message of getMaxDisparity
SzabolcsGergely Sep 20, 2021
6e25fae
Update core: Update FW with runtime disparity range fix
SzabolcsGergely Sep 21, 2021
140ae1a
Replace deprecated getMaxDisparity() function
SzabolcsGergely Sep 21, 2021
31d7a79
Expose all stereo HW settings in stereo_depth_from_host example
SzabolcsGergely Sep 21, 2021
deb65ac
Revert stress test settings
SzabolcsGergely Sep 21, 2021
b778fda
Update depthai-core to latest develop
SzabolcsGergely Sep 22, 2021
0e98fdc
Merge pull request #347 from luxonis/stereo_fixes
SzabolcsGergely Sep 22, 2021
3fdf376
Fix bootloader version example
SzabolcsGergely Sep 22, 2021
0aea94e
Fix still image output in RGB postprocessing
SzabolcsGergely Sep 24, 2021
7c798bc
Updated core
themarpe Sep 25, 2021
5f408fd
Update core to latest develop with ppenc fixes
SzabolcsGergely Sep 25, 2021
a768e72
Merge pull request #378 from luxonis/ppenc_fixes
SzabolcsGergely Sep 25, 2021
411d615
Add confidence map output to stereo node
SzabolcsGergely Sep 28, 2021
83c996e
Update to latest depthai-core develop
SzabolcsGergely Sep 28, 2021
a46e951
Merge pull request #382 from luxonis/stereo_confidence_map
SzabolcsGergely Sep 28, 2021
388dc8f
CI: Fix code styling in depthai-core
SzabolcsGergely Sep 28, 2021
2da875e
Added mesh I/O functionality
MOj0 Sep 25, 2021
ce909b0
Rebased to develop branch, fixes
MOj0 Sep 30, 2021
eea2121
Fixed according to PR comments
MOj0 Sep 25, 2021
833695d
Minor fix
MOj0 Sep 26, 2021
2bdb824
Refactored to use loadMeshData
MOj0 Sep 27, 2021
fa788aa
Fixed according to PR comments
MOj0 Sep 27, 2021
41f508a
Minor fix
MOj0 Sep 27, 2021
1c0b028
Merged with functionality of stereo_depth_video
MOj0 Sep 27, 2021
3cc6300
Replaced stereo_depth_video with mesh_stereo
MOj0 Sep 29, 2021
1d9c8f4
Rebased to develop branch, fixes
MOj0 Sep 25, 2021
cbaff14
Merge pull request #379 from luxonis/gen2_mesh_api
MOj0 Sep 30, 2021
252064a
Added python bindings for getFov
Erol444 Oct 2, 2021
ae4d561
Update depthai-core
Erol444 Oct 2, 2021
75c7367
Merge pull request #386 from luxonis/calib_fov_calculated
SzabolcsGergely Oct 3, 2021
c47f5b1
Hotfix for FW message cache coherency
SzabolcsGergely Oct 3, 2021
3f59c27
Merge branch 'develop' into spi_improvements
themarpe Oct 5, 2021
350a9d8
Modified 'author_email' for Python package (#389)
themarpe Oct 7, 2021
c0f28a6
Merge branch 'spi_improvements' into develop
themarpe Oct 7, 2021
55fe889
Merge branch 'develop' of github.com:luxonis/depthai-python into develop
themarpe Oct 7, 2021
e72de86
Add Python 3.10 to GitHub CI build
alex-luxonis Oct 11, 2021
e787dbd
GitHub CI: '3.10' quoted, to not end up as 3.1.
alex-luxonis Oct 11, 2021
0d80161
Fix deprecated getMaxDisparity binding
SzabolcsGergely Oct 11, 2021
115ca4e
Update FW: increase ImageManip warp max out height: 1520 -> 2560
alex-luxonis Oct 12, 2021
176073b
Merge remote-tracking branch 'origin/ci_python3.10' into develop
themarpe Oct 12, 2021
c00cf59
Updated core
themarpe Oct 12, 2021
3677862
Add Python3.10 to ci/build-wheels.sh
alex-luxonis Oct 12, 2021
4cdaa66
Merge branch 'main' into develop
themarpe Oct 13, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
python-architecture: [x64, x86]
steps:
- name: Cache .hunter folder
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
steps:
- name: Cache .hunter folder
uses: actions/cache@v2
Expand Down Expand Up @@ -259,7 +259,7 @@ jobs:
/opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar
mv dist/* wheelhouse/audited/
- name: Build wheels
run: for PYBIN in /opt/python/cp3*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
run: for PYBIN in /opt/python/cp3{6..10}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
- name: Audit wheels
run: for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done
- name: Archive wheel artifacts
Expand Down Expand Up @@ -316,7 +316,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v') != true
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
- name: Building wheels
run: for PYBIN in /opt/python/cp3*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
run: for PYBIN in /opt/python/cp3{6..10}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
- name: Auditing wheels
run: for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done
- name: Archive wheel artifacts
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ find_package(pybind11 CONFIG REQUIRED)
# Add files for python module
pybind11_add_module(${TARGET_NAME}
src/py_bindings.cpp
src/XLinkConnectionBindings.cpp
src/XLinkBindings.cpp
src/DeviceBindings.cpp
src/CalibrationHandlerBindings.cpp
src/DeviceBootloaderBindings.cpp
Expand Down Expand Up @@ -157,6 +157,7 @@ target_link_libraries(${TARGET_NAME}
pybind11::pybind11
depthai::core # Use non-opencv target as we use opencv-python in bindings
hedley
pybind11_json
)

# Find Git
Expand Down
2 changes: 1 addition & 1 deletion ci/build-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ yum install -y libusb1-devel
#yum remove -y libusb1

# Compile wheels
for PYBIN in /opt/python/cp3*/bin; do
for PYBIN in /opt/python/cp3{6..10}*/bin; do
#"${PYBIN}/pip" install -r /io/requirements.txt
"${PYBIN}/pip" wheel /io/ -w wheelhouse/
done
Expand Down
2 changes: 1 addition & 1 deletion depthai-core
Submodule depthai-core updated 66 files
+64 −1 .github/workflows/main.workflow.yml
+16 −1 CMakeLists.txt
+3 −1 cmake/Depthai/DepthaiBootloaderConfig.cmake
+1 −1 cmake/Depthai/DepthaiDeviceSideConfig.cmake
+13 −3 cmake/Hunter/config.cmake
+4 −1 cmake/depthaiConfig.cmake.in
+20 −5 cmake/depthaiDependencies.cmake
+5 −2 examples/CMakeLists.txt
+68 −0 examples/src/bootloader_config.cpp
+1 −2 examples/src/bootloader_version.cpp
+38 −61 examples/src/calibration_reader.cpp
+1 −1 examples/src/depth_preview.cpp
+76 −0 examples/src/flash_bootloader.cpp
+1 −21 examples/src/mono_depth_mobilenetssd.cpp
+1 −1 examples/src/rgb_depth_aligned.cpp
+1 −8 examples/src/rgb_encoding_mono_mobilenet_depth.cpp
+2 −3 examples/src/rgb_preview.cpp
+0 −7 examples/src/spatial_mobilenet_mono.cpp
+4 −8 examples/src/stereo_depth_video.cpp
+6 −9 include/depthai/common/CameraBoardSocket.hpp
+8 −11 include/depthai/common/UsbSpeed.hpp
+27 −3 include/depthai/device/CalibrationHandler.hpp
+16 −2 include/depthai/device/Device.hpp
+84 −9 include/depthai/device/DeviceBase.hpp
+233 −16 include/depthai/device/DeviceBootloader.hpp
+3 −0 include/depthai/openvino/OpenVINO.hpp
+24 −10 include/depthai/pipeline/Pipeline.hpp
+43 −0 include/depthai/pipeline/datatype/ImageManipConfig.hpp
+17 −2 include/depthai/pipeline/datatype/ImgFrame.hpp
+32 −0 include/depthai/pipeline/datatype/StereoDepthConfig.hpp
+9 −8 include/depthai/pipeline/datatype/Tracklets.hpp
+2 −0 include/depthai/pipeline/node/Script.hpp
+6 −0 include/depthai/pipeline/node/SpatialDetectionNetwork.hpp
+66 −2 include/depthai/pipeline/node/StereoDepth.hpp
+1 −1 include/depthai/utility/Initialization.hpp
+3 −6 include/depthai/xlink/XLinkConnection.hpp
+18 −1 include/depthai/xlink/XLinkStream.hpp
+1 −1 shared/depthai-bootloader-shared
+3 −2 shared/depthai-bootloader-shared.cmake
+1 −1 shared/depthai-shared
+3 −2 shared/depthai-shared.cmake
+66 −41 src/device/CalibrationHandler.cpp
+1 −1 src/device/CallbackHandler.cpp
+1 −1 src/device/DataQueue.cpp
+8 −1 src/device/Device.cpp
+155 −132 src/device/DeviceBase.cpp
+480 −108 src/device/DeviceBootloader.cpp
+3 −0 src/openvino/OpenVINO.cpp
+26 −15 src/pipeline/Pipeline.cpp
+24 −0 src/pipeline/datatype/ImageManipConfig.cpp
+8 −0 src/pipeline/datatype/ImgFrame.cpp
+35 −8 src/pipeline/datatype/StereoDepthConfig.cpp
+4 −0 src/pipeline/node/SpatialDetectionNetwork.cpp
+18 −7 src/pipeline/node/StereoDepth.cpp
+0 −68 src/utility/BootloaderHelper.hpp
+37 −7 src/utility/Initialization.cpp
+52 −0 src/utility/Platform.cpp
+13 −0 src/utility/Platform.hpp
+178 −110 src/utility/Resources.cpp
+5 −4 src/utility/Resources.hpp
+42 −19 src/xlink/XLinkConnection.cpp
+13 −8 src/xlink/XLinkStream.cpp
+6 −0 tests/CMakeLists.txt
+51 −0 tests/src/bootloader_config_test.cpp
+24 −0 tests/src/device_usbspeed_test.cpp
+136 −0 tests/src/unlimited_io_connection_test.cpp
31 changes: 25 additions & 6 deletions docs/source/components/nodes/script.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,34 @@ Usage
Interfacing with GPIOs
######################

In the script node you can interface with GPIOs of the VPU. Currently supported functions are:
In the script node you can interface with GPIOs of the VPU using module GPIO. Currently supported functions are:

.. code-block:: python

import GPIO # module
GPIO.read(pin)
GPIO.write(pin, value)
GPIO.setPwm(pin, highCount, lowCount, repeat=0) # repeat == 0 means indefinite
GPIO.enablePwm(pin, enable)
# Module
import GPIO

# General
GPIO.setup(gpio, dir, pud, exclusive)
GPIO.release(gpio)
GPIO.write(gpio, value)
GPIO.read(gpio)

# Interrupts
GPIO.waitInterruptEvent(gpio = -1) # blocks until any interrupt or interrupt by specified gpio is fired. Interrupts with callbacks are ignored here
GPIO.hasInterruptEvent(gpio = -1) # returns whether interrupt happened on any or specfied gpio. Interrupts with callbacks are ignored here
GPIO.setInterrupt(gpio, edge, priority, callback = None) # adds interrupt to specified pin
GPIO.clearInterrupt(gpio) # clears interrupt of specified pin

# PWM
GPIO.setPwm(gpio, highCount, lowCount, repeat=0) # repeat == 0 means indefinite
GPIO.enablePwm(gpio, enable)

# Enumerations
GPIO.Direction: GPIO.IN, GPIO.OUT
GPIO.State: GPIO.LOW, GPIO.HIGH
GPIO.PullDownUp: GPIO.PULL_NONE, GPIO.PULL_DOWN, GPIO.PULL_UP
GPIO.Edge: GPIO.RISING, GPIO.FALLING, GPIO.LEVEL_HIGH, GPIO.LEVEL_LOW

Using DepthAI :ref:`Messages <components_messages>`
###################################################
Expand Down
53 changes: 53 additions & 0 deletions examples/bootloader_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env python3

import depthai as dai
import sys

usage = False
read = True
clear = False
path = ''
if len(sys.argv) >= 2:
op = sys.argv[1]
if op == 'read':
read = True
elif op == 'flash':
read = False
if len(sys.argv) >= 3:
path = sys.argv[2]
elif op == 'clear':
clear = True
read = False
else:
usage = True
else:
usage = True

if usage:
print(f'Usage: {sys.argv[0]} [read/flash/clear] [flash: path/to/config/json]')
exit(-1)

(res, info) = dai.DeviceBootloader.getFirstAvailableDevice()

if res:
print(f'Found device with name: {info.desc.name}');
with dai.DeviceBootloader(info) as bl:
if read:
print('Current flashed configuration')
print(f'{bl.readConfigData()}')
else:
success = None
error = None
if clear:
(success, error) = bl.flashConfigClear()
else:
if path == '':
(success, error) = bl.flashConfig(dai.DeviceBootloader.Config())
else:
(success, error) = bl.flashConfigFile(path)
if success:
print('Successfully flashed bootloader configuration')
else:
print(f'Error flashing bootloader configuration: {error}')
else:
print('No devices found')
4 changes: 2 additions & 2 deletions examples/bootloader_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
(res, info) = dai.DeviceBootloader.getFirstAvailableDevice()

if res == True:
print(f'Found device with name: {info.desc.name}');
print(f'Found device with name: {info.desc.name}')
bl = dai.DeviceBootloader(info)
print(f'Version: {bl.getVersion()}');
print(f'Version: {bl.getVersion()}')
else:
print('No devices found')
2 changes: 1 addition & 1 deletion examples/depth_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
inDepth = q.get() # blocking call, will wait until a new data has arrived
frame = inDepth.getFrame()
# Normalization for better visualization
frame = (frame * (255 / depth.getMaxDisparity())).astype(np.uint8)
frame = (frame * (255 / depth.initialConfig.getMaxDisparity())).astype(np.uint8)

cv2.imshow("disparity", frame)

Expand Down
56 changes: 56 additions & 0 deletions examples/flash_bootloader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python3

import depthai as dai
import sys
import time

blType = dai.DeviceBootloader.Type.AUTO
if len(sys.argv) > 1:
if sys.argv[1] == 'usb':
blType = dai.DeviceBootloader.Type.USB
elif sys.argv[1] == 'network':
blType = dai.DeviceBootloader.Type.NETWORK
else:
print("Specify either 'usb' or 'network' bootloader type")
exit()

(found, info) = dai.DeviceBootloader.getFirstAvailableDevice()
if not found:
print("No device found to flash. Exiting.")
exit(-1)

hasBootloader = (info.state == dai.XLinkDeviceState.X_LINK_BOOTLOADER)
if hasBootloader:
print("Warning! Flashing bootloader can potentially soft brick your device and should be done with caution.")
print("Do not unplug your device while the bootloader is flashing.")
print("Type 'y' and press enter to proceed, otherwise exits: ")
if input() != 'y':
print("Prompt declined, exiting...")
exit(-1)

# Open DeviceBootloader and allow flashing bootloader
print(f"Booting latest bootloader first, will take a tad longer...")
with dai.DeviceBootloader(info, allowFlashingBootloader=True) as bl:
currentBlType = bl.getType()

if blType == dai.DeviceBootloader.Type.AUTO:
blType = currentBlType

# Check if bootloader type is the same, if already booted by bootloader (not in USB recovery mode)
if currentBlType != blType and hasBootloader:
print(f"Are you sure you want to flash '{blType.name}' bootloader over current '{currentBlType.name}' bootloader?")
print(f"Type 'y' and press enter to proceed, otherwise exits: ")
if input() != 'y':
print("Prompt declined, exiting...")
exit(-1)

# Create a progress callback lambda
progress = lambda p : print(f'Flashing progress: {p*100:.1f}%')

print(f"Flashing {blType.name} bootloader...")
startTime = time.monotonic()
(res, message) = bl.flashBootloader(dai.DeviceBootloader.Memory.FLASH, blType, progress)
if res:
print("Flashing successful. Took", time.monotonic() - startTime, "seconds")
else:
print("Flashing failed:", message)
14 changes: 1 addition & 13 deletions examples/mono_depth_mobilenetssd.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
labelMap = ["background", "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow",
"diningtable", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"]

flipRectified = True

# Create pipeline
pipeline = dai.Pipeline()

Expand Down Expand Up @@ -97,7 +95,7 @@ def show(name, frame):
# Show the frame
cv2.imshow(name, frame)

disparityMultiplier = 255 / stereo.getMaxDisparity()
disparityMultiplier = 255 / stereo.initialConfig.getMaxDisparity()

while True:
# Instead of get (blocking), we use tryGet (nonblocking) which will return the available data or None otherwise
Expand All @@ -107,16 +105,6 @@ def show(name, frame):

if inRight is not None:
rightFrame = inRight.getCvFrame()
if flipRectified:
rightFrame = cv2.flip(rightFrame, 1)

if inDet is not None:
detections = inDet.detections
if flipRectified:
for detection in detections:
swap = detection.xmin
detection.xmin = 1 - detection.xmax
detection.xmax = 1 - swap

if inDisparity is not None:
# Frame is transformed, normalized, and color map will be applied to highlight the depth info
Expand Down
2 changes: 1 addition & 1 deletion examples/rgb_depth_aligned.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

if latestPacket["depth"] is not None:
frameDepth = latestPacket["depth"].getFrame()
maxDisparity = stereo.getMaxDisparity()
maxDisparity = stereo.initialConfig.getMaxDisparity()
# Optional, extend range 0..95 -> 0..255, for a better visualisation
if 1: frameDepth = (frameDepth * 255. / maxDisparity).astype(np.uint8)
# Optional, apply false colorization
Expand Down
10 changes: 2 additions & 8 deletions examples/rgb_encoding_mono_mobilenet_depth.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
labelMap = ["background", "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow",
"diningtable", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"]

flipRectified = True

# Create pipeline
pipeline = dai.Pipeline()

Expand Down Expand Up @@ -54,9 +52,7 @@
monoLeft.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
videoEncoder.setDefaultProfilePreset(1920, 1080, 30, dai.VideoEncoderProperties.Profile.H265_MAIN)

# Note: the rectified streams are horizontally mirrored by default
depth.initialConfig.setConfidenceThreshold(255)
depth.setRectifyMirrorFrame(False)
depth.setRectifyEdgeFillColor(0) # Black, to better see the cutout

nn.setConfidenceThreshold(0.5)
Expand All @@ -81,7 +77,7 @@
nn.out.link(nnOut.input)

# Disparity range is used for normalization
disparityMultiplier = 255 / depth.getMaxDisparity()
disparityMultiplier = 255 / depth.initialConfig.getMaxDisparity()

# Connect to device and start pipeline
with dai.Device(pipeline) as device:
Expand Down Expand Up @@ -126,10 +122,8 @@ def frameNorm(frame, bbox):
frameManip = inManip.getCvFrame()

if inDisparity is not None:
# Flip disparity frame, normalize it and apply color map for better visualization
# Apply color map for better visualization
frameDisparity = inDisparity.getCvFrame()
if flipRectified:
frameDisparity = cv2.flip(frameDisparity, 1)
frameDisparity = (frameDisparity*disparityMultiplier).astype(np.uint8)
frameDisparity = cv2.applyColorMap(frameDisparity, cv2.COLORMAP_JET)

Expand Down
8 changes: 4 additions & 4 deletions examples/rgb_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
# Linking
camRgb.preview.link(xoutRgb.input)

# Connect to device and start pipeline
with dai.Device(pipeline) as device:

# Connect to the device
with dai.Device(pipeline, dai.UsbSpeed.SUPER) as device:
# Print out available cameras
print('Connected cameras: ', device.getConnectedCameras())
# Print out usb speed
print('Usb speed: ', device.getUsbSpeed().name)
Expand All @@ -31,7 +31,7 @@
qRgb = device.getOutputQueue(name="rgb", maxSize=4, blocking=False)

while True:
inRgb = qRgb.get() # blocking call, will wait until a new data has arrived
inRgb = qRgb.get() # blocking call, will wait until a new data has arrived

# Retrieve 'bgr' (opencv format) frame
cv2.imshow("rgb", inRgb.getCvFrame())
Expand Down
1 change: 1 addition & 0 deletions examples/spatial_location_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@

if newConfig:
config.roi = dai.Rect(topLeft, bottomRight)
config.calculationAlgorithm = dai.SpatialLocationCalculatorAlgorithm.AVERAGE
cfg = dai.SpatialLocationCalculatorConfig()
cfg.addROI(config)
spatialCalcConfigInQueue.send(cfg)
Expand Down
7 changes: 0 additions & 7 deletions examples/spatial_mobilenet_mono.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"diningtable", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"]

syncNN = True
flipRectified = True

# Create pipeline
pipeline = dai.Pipeline()
Expand Down Expand Up @@ -118,8 +117,6 @@
startTime = currentTime

rectifiedRight = inRectified.getCvFrame()
if flipRectified:
rectifiedRight = cv2.flip(rectifiedRight, 1)

depthFrame = inDepth.getFrame()
depthFrameColor = cv2.normalize(depthFrame, None, 255, 0, cv2.NORM_INF, cv2.CV_8UC1)
Expand All @@ -146,10 +143,6 @@
height = rectifiedRight.shape[0]
width = rectifiedRight.shape[1]
for detection in detections:
if flipRectified:
swap = detection.xmin
detection.xmin = 1 - detection.xmax
detection.xmax = 1 - swap
# Denormalize bounding box
x1 = int(detection.xmin * width)
x2 = int(detection.xmax * width)
Expand Down
Loading