• OAK-D-POE Save Jpeg Images to SDCARD

Hi,

I have OAK-D-POE device, and I followed the example from depthai-python and it saves the jpeg frames to emmc flash.

I would like to save the jpeg frames to sdcard; however, the device only mounts 'mmcsd-0-0'. I need some help how to save the frames to sdcard slot.

Regards

    Hello,

    I tested the example script_jpeg_to_sdcard.py, but it is getting the following error:

    [1944301061766E1300] [192.168.5.223] [7.593] [Script(5)] [critical] FileNotFoundError: [Errno 2] N: '/media/mmcsd-0-0'
    At:
    <script>(20): <module>

    I inserted the code below to check if the sdcard is mounted, but it seems that only "dev" and "etc" directory is listed.

    listDirectories = './../'
    node.warn("Files in a directory -->"+ str(os.listdir(listDirectories)))

    [1944301061766E1300] [192.168.5.223] [7.592] [Script(5)] [warning] Files in a directory -->['dev', 'etc']

    Thoughts?

    Hi rarimanr
    Did you use the sd-card support branch? You have to manually install the depthai library from that branch otherwise the firmware stays the same.

    Thanks,
    Jaka

    Hi @jakaskerl ,

    Yes, I used sd-card support branch.

    I had to downgrade the depthai to 2.15.0.0. However, it seems that the current bootloader (0.0.24) is not compatible with deptahi 2.15.0.0, right? When I upgrade it to 2.22.0.0, I can upload the firmware.

    What is the bootloader version compatible to depthai 2.15.0.0?

    Thanks,

      Hi rarimanr
      I believe by running the device manager you can downgrade the bootloader version.

      Thanks,
      Jaka

      Hi rarimanr
      Oh my bad that was a bit before my time; I didn't realize we didn't have device manager GUI then. I believe this script should upload the correct bootloader version to your device.

      Let me know if if works.

      Thanks,
      Jaka

      Hi rarimanr
      Try to manually specify the ip with dai.DeviceInfo(). The bootloader is likely more buggy since it's an older version.

      Yes, but this was deprecated and we made it community support only, as some functions needed for sd branch interfered with stock depthai functions and therefore never were mainlined.

      Thanks,
      Jaka

      Hi @jakaskerl ,

      thanks for your reply.

      I still get the same error. Here is the debug level log:

      [2023-08-15 11:19:34.110] [debug] Python bindings - version: 2.15.0.0.dev+c2d04a380f0fc85109bb40d74d1f84986f2aac67 from 2022-03-09 19:47:35 +0200 build:
      2022-03-09 19:39:24 +0000
      [2023-08-15 11:19:34.111] [debug] Library information - version: 2.15.0, commit: 751fec5afe0a56612ab294ae8764740921190609 from 2022-03-09 19:24:11 +0200, build: 2022-03-09 19:39:12 +0000
      [2023-08-15 11:19:34.115] [debug] Initialize - finished
      [2023-08-15 11:19:34.225] [debug] Resources - Archive 'depthai-bootloader-fwp-0.0.17.tar.xz' open: 2ms, archive read: 110ms
      [2023-08-15 11:19:34.640] [debug] Resources - Archive 'depthai-device-fwp-67c9c554e0d44d1ddd2d243aef7a1fbc831eac72.tar.xz' open: 2ms, archive read: 525ms192.168.5.223
      [2023-08-15 11:19:34.782] [debug] Device - OpenVINO version: 2021.4
      [2023-08-15 11:19:34.783] [debug] Environment 'DEPTHAI_WATCHDOG_INITIAL_DELAY' set to '60000'
      [2023-08-15 11:19:34.783] [warning] Watchdog initial delay set to 60000ms
      [2023-08-15 11:19:34.784] [debug] Device - BoardConfig: {"gpio":[],"uart":[],"usb":{"flashBootedPid":63037,"flashBootedVid":999,"maxSpeed":4,"pid":63035,"vid":999},"watchdogInitialDelayMs":60000,"watchdogTimeoutMs":null}
      libnop:
      0000: b9 05 b9 05 81 e7 03 81 3b f6 81 e7 03 81 3d f6 04 be 81 60 ea bb 00 bb 00
      [2023-08-15 11:19:34.799] [debug] Environment 'DEPTHAI_CONNECT_TIMEOUT' set to '60000'
      [2023-08-15 11:19:34.799] [debug] Environment 'DEPTHAI_BOOTUP_TIMEOUT' set to '60000'
      [2023-08-15 11:19:36.262] [debug] Booting FW with Bootloader. Version 0.0.18, Time taken: 996ms
      [2023-08-15 11:19:36.263] [debug] DeviceBootloader about to be closed...
      [2023-08-15 11:19:36.265] [debug] XLinkResetRemote of linkId: (0)
      [2023-08-15 11:19:36.881] [debug] DeviceBootloader closed, 617
      Traceback (most recent call last):
      File "c:\Users\rariman.rocha\Documents\Working\depthai\depthai-python-sdcard_support\depthai-python-sdcard_support\examples\Script\script_jpeg_to_sdcard.py", line 95, in <module>
      with dai.Device(pipeline, deviceInfos[0]) as device:
      RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND

      Hi rarimanr ,
      I think it would be best if you create feature request on depthai-core , to either update the sdcard_support to the latest depthai version, or to merge the branch.
      Otherwise, you can flash bootloader with this script, just note that flashUserBootaloder might need to be removed, as I don't think it was added in 2.15 already: https://docs.luxonis.com/projects/api/en/latest/samples/bootloader/flash_bootloader/#flash-bootloader

      6 months later

      It's fantastic to hear about your work with the OAK-D-POE device! To save jpeg frames to the SD card, you'll likely need to adjust the code to specify the path to the SD card directory. Ensure that the SD card is properly mounted and accessible by the device. You might also want to check if there are any specific configurations or permissions needed for writing to the SD card.Additionally, if you encounter any issues with large file sizes, consider using jpg compress to optimize them for efficient storage. This tool can help reduce the file sizes while preserving image quality, making it easier to manage and store your jpeg frames on the SD card.