• Community
  • OAK-D Not Intializing when connected to computer

Hello, when I run the demo "python3 depthai_demo.py" in Pycharm 3.8, It seems to run, but the camera is not initialized. I get the following message: Am I missing something?

(venv) chrisfranklin@MacBook-Pro-2 depthai % python3 depthai_demo.py
No calibration file. Using Calibration Defaults.
Using depthai module from: /Users/chrisfranklin/depthai/venv/lib/python3.8/site-packages/depthai.cpython-38-darwin.so
Depthai version installed: 0.4.0.0
Depthai version required: 0.4.0.0
Compiled mode found: compiled for 14 shaves, 14 cmx_slices and 1 NN_engines
XLink initialized.
Sending internal device firmware
Successfully connected to device.
Usb speed : Super/5000Mbps
Mx serial id : 14442C1051D612D100
Loading config file
Attempting to open stream config_d2h
watchdog started
Successfully opened stream config_d2h with ID #0!
Closing stream config_d2h: ...
Closing stream config_d2h: DONE.
EEPROM data: valid (v5)
Board name : BW1098OBC
Board rev : R0M0E0
HFOV L/R : 71.86 deg
HFOV RGB : 68.7938 deg
L-R distance : 7.5 cm
L-RGB distance : 3.75 cm
L/R swapped : yes
L/R crop region: center
Rectification Rotation R1 (left):
0.999987, 0.001616, 0.004806,
-0.001625, 0.999997, 0.001860,
-0.004803, -0.001867, 0.999987,
Rectification Rotation R2 (right):
0.999959, -0.004182, -0.008074,
0.004167, 0.999990, -0.001880,
0.008082, 0.001847, 0.999966,
Calibration intrinsic matrix M1 (left):
858.698242, 0.000000, 648.131226,
0.000000, 859.186340, 397.729065,
0.000000, 0.000000, 1.000000,
Calibration intrinsic matrix M2 (right):
855.945435, 0.000000, 635.460083,
0.000000, 856.590637, 398.770081,
0.000000, 0.000000, 1.000000,
Calibration rotation matrix R:
0.999900, 0.005767, 0.012895,
-0.005815, 0.999976, 0.003686,
-0.012874, -0.003761, 0.999910,
Calibration translation matrix T:
-7.504957,
0.031384,
0.060600,
Calibration Distortion Coeff d1 (Left):
-6.171211, 21.034943, 0.001266, -0.001112, -22.421570, -6.215688, 21.208927,
-22.592260, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
Calibration Distortion Coeff d2 (Right):
-5.796284, 19.183083, 0.001031, -0.001893, -19.380114, -5.843046, 19.363472,
-19.553144, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
['metaout', 'previewout']
Available streams: ['meta_d2h', 'left', 'right', 'disparity', 'depth', 'metaout', 'previewout', 'jpegout', 'video', 'object_tracker', 'rectified_left', 'rectified_right', 'color']
/Users/chrisfranklin/depthai/resources/nn/mobilenet-ssd/mobilenet-ssd.json
depthai: Calibration file is not specified, will use default setting;
config_h2d json:
{"board":{"calib_data":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],"mesh_left":[0.0],"mesh_right":[0.0]},"load_inBlob":true,"pipeline":{"streams":[{"name":"metaout"},{"name":"previewout"}]},"ai":{"NCEs":1,"NN_config":{"NN_family":"mobilenet","confidence_threshold":0.5,"output_format":"detection"},"blob0_size":14477056,"blob1_size":0,"calc_dist_to_bb":true,"camera_input":"rgb","cmx_slices":14,"keep_aspect_ratio":true,"num_stages":1,"shaves":14},"app":{"enable_reconfig":true,"sync_sequence_numbers":false,"sync_video_meta_streams":false,"usb_chunk_KiB":64},"board":{"clear-eeprom":false,"left_fov_deg":71.86000061035156,"left_to_rgb_distance_m":0.019999999552965164,"left_to_right_distance_m":0.09000000357627869,"name":"","override-eeprom":false,"revision":"","rgb_fov_deg":68.7938003540039,"stereo_center_crop":false,"store-to-eeprom":false,"swap-left-and-right-cameras":true},"camera":{"mono":{"fps":30.0,"resolution_h":720,"resolution_w":1280},"rgb":{"fps":30.0,"resolution_h":1080,"resolution_w":1920}},"depth":{"depth_limit_mm":10000,"lr_check":false,"median_kernel_size":7,"padding_factor":0.30000001192092896,"warp_rectify":{"edge_fill_color":0,"mirror_frame":true,"use_mesh":false}},"ot":{"confidence_threshold":0.5,"max_tracklets":20}}
size of input string json_config_obj to config_h2d is ->1654
size of json_config_obj that is expected to be sent to config_h2d is ->1048576
Attempting to open stream config_h2d
Successfully opened stream config_h2d with ID #1!
Writing 1048576 bytes to config_h2d
!!! XLink write successful: config_h2d (1048576)
Closing stream config_h2d: ...
Closing stream config_h2d: DONE.
Creating observer stream host_capture: ...
Attempting to open stream host_capture
Successfully opened stream host_capture with ID #0!
Creating observer stream host_capture: DONE.
Read: 14477056
Attempting to open stream inBlob
Successfully opened stream inBlob with ID #1!
Writing 14477056 bytes to inBlob
!!! XLink write successful: inBlob (14477056)
Closing stream inBlob: ...
Closing stream inBlob: DONE.
depthai: done sending Blob file /Users/chrisfranklin/depthai/resources/nn/mobilenet-ssd/mobilenet-ssd.blob.sh14cmx14NCE1
Attempting to open stream outBlob
Successfully opened stream outBlob with ID #2!
Closing stream outBlob: ...
Closing stream outBlob: DONE.
Input layer :
Name: data
Index: 0
Element type: uint8
Element size: 1byte
Offset: 0 byte
Dimensions: [Batch : 1, Channel : 3, Height : 300, Width : 300]

Output layer :
Name: detection_out
Index: 0
Element type: float16
Element size: 2 bytes
Offset: 0 byte
Dimensions: [Batch : 1, Channel : 1, Height : 100, Width : 7]

CNN to depth bounding-box mapping: start(318, 38), max_size(643, 643)
Host stream start:metaout
Opening stream for read: metaout
Attempting to open stream metaout
Successfully opened stream metaout with ID #1!
Starting thread for stream: metaout
Host stream start:previewout
Opening stream for read: previewout
Attempting to open stream previewout
Started thread for stream: metaout
Successfully opened stream previewout with ID #2!
Starting thread for stream: previewout
depthai: INIT OK!
Started thread for stream: previewout

    Hi DMS-1 ,

    As far as I can tell your OpenCV install is refusing to show the preview window, which I think is the issue. If this is indeed the issue, we have seen this randomly before with OpenCV installs on some hosts.

    Is this tutorial able to show images (Lionel Messi) on your computer?

    https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_image_display/py_image_display.html

    Thanks and sorry about the trouble,
    Brandon

    Hello Brandon, I am on a different computer. I downloaded all the necessary files covered in
    Delphai/ Python API. I still get the same message as before. I followed the tutorial as your requested in this email. The picture shows up. I am at a lost. Do you think it’s the OAK-D device? Waiting for your reply

    different machine (iMac) Was able to run the tutorial. I just used a different picture

    Also, I did a clean install of Python and Pycharm on my MacBook. I still get the same message with the window not poping up

    (depthai ) chrisfranklin@MacBook-Pro-2 depthai % python3 depthai_demo.py
    Traceback (most recent call last):
    File "/Users/chrisfranklin/depthai/depthai_demo.py", line 7, in <module>
    import cv2
    ModuleNotFoundError: No module named 'cv2'
    (depthai ) chrisfranklin@MacBook-Pro-2 depthai % python3 -m pip install -r requirements.txt
    Ignoring open3d: markers 'platform_machine != "armv7l" and python_version < "3.9"' don't match your environment
    Collecting argcomplete==1.12.1
    Using cached argcomplete-1.12.1-py2.py3-none-any.whl (38 kB)
    Collecting depthai==0.4.0.0
    Using cached depthai-0.4.0.0-cp39-cp39-macosx_10_9_x86_64.whl (2.9 MB)
    Collecting numpy==1.19.3
    Using cached numpy-1.19.3-cp39-cp39-macosx_10_9_x86_64.whl (15.9 MB)
    Collecting opencv-python==4.4.0.46
    Using cached opencv_python-4.4.0.46-cp39-cp39-macosx_10_13_x86_64.whl (52.4 MB)
    Collecting pyyaml==5.3.1
    Using cached PyYAML-5.3.1.tar.gz (269 kB)
    Collecting requests==2.24.0
    Using cached requests-2.24.0-py2.py3-none-any.whl (61 kB)
    Collecting certifi>=2017.4.17
    Using cached certifi-2020.12.5-py2.py3-none-any.whl (147 kB)
    Collecting chardet<4,>=3.0.2
    Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
    Collecting idna<3,>=2.5
    Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
    Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
    Using cached urllib3-1.25.11-py2.py3-none-any.whl (127 kB)
    Using legacy 'setup.py install' for pyyaml, since package 'wheel' is not installed.
    Installing collected packages: urllib3, numpy, idna, chardet, certifi, requests, pyyaml, opencv-python, depthai, argcomplete
    Running setup.py install for pyyaml ... done
    Successfully installed argcomplete-1.12.1 certifi-2020.12.5 chardet-3.0.4 depthai-0.4.0.0 idna-2.10 numpy-1.19.3 opencv-python-4.4.0.46 pyyaml-5.3.1 requests-2.24.0 urllib3-1.25.11
    (depthai ) chrisfranklin@MacBook-Pro-2 depthai % python3 depthai_demo.py
    No calibration file. Using Calibration Defaults.
    Using depthai module from: /Users/chrisfranklin/depthai /lib/python3.9/site-packages/depthai.cpython-39-darwin.so
    Depthai version installed: 0.4.0.0
    Depthai version required: 0.4.0.0
    Compiled mode found: compiled for 14 shaves, 14 cmx_slices and 1 NN_engines
    XLink initialized.
    Sending internal device firmware
    Successfully connected to device.
    Usb speed : High/480Mbps
    Mx serial id : 14442C1051D612D100
    Loading config file
    Attempting to open stream config_d2h
    watchdog started
    Successfully opened stream config_d2h with ID #0!
    Closing stream config_d2h: ...
    Closing stream config_d2h: DONE.
    EEPROM data: valid (v5)
    Board name : BW1098OBC
    Board rev : R0M0E0
    HFOV L/R : 71.86 deg
    HFOV RGB : 68.7938 deg
    L-R distance : 7.5 cm
    L-RGB distance : 3.75 cm
    L/R swapped : yes
    L/R crop region: center
    Rectification Rotation R1 (left):
    0.999987, 0.001616, 0.004806,
    -0.001625, 0.999997, 0.001860,
    -0.004803, -0.001867, 0.999987,
    Rectification Rotation R2 (right):
    0.999959, -0.004182, -0.008074,
    0.004167, 0.999990, -0.001880,
    0.008082, 0.001847, 0.999966,
    Calibration intrinsic matrix M1 (left):
    858.698242, 0.000000, 648.131226,
    0.000000, 859.186340, 397.729065,
    0.000000, 0.000000, 1.000000,
    Calibration intrinsic matrix M2 (right):
    855.945435, 0.000000, 635.460083,
    0.000000, 856.590637, 398.770081,
    0.000000, 0.000000, 1.000000,
    Calibration rotation matrix R:
    0.999900, 0.005767, 0.012895,
    -0.005815, 0.999976, 0.003686,
    -0.012874, -0.003761, 0.999910,
    Calibration translation matrix T:
    -7.504957,
    0.031384,
    0.060600,
    Calibration Distortion Coeff d1 (Left):
    -6.171211, 21.034943, 0.001266, -0.001112, -22.421570, -6.215688, 21.208927,
    -22.592260, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
    Calibration Distortion Coeff d2 (Right):
    -5.796284, 19.183083, 0.001031, -0.001893, -19.380114, -5.843046, 19.363472,
    -19.553144, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
    ['metaout', 'previewout']
    Available streams: ['meta_d2h', 'left', 'right', 'disparity', 'depth', 'metaout', 'previewout', 'jpegout', 'video', 'object_tracker', 'rectified_left', 'rectified_right', 'color']
    /Users/chrisfranklin/depthai/resources/nn/mobilenet-ssd/mobilenet-ssd.json
    depthai: Calibration file is not specified, will use default setting;
    config_h2d json:
    {"board":{"calib_data":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],"mesh_left":[0.0],"mesh_right":[0.0]},"load_inBlob":true,"pipeline":{"streams":[{"name":"metaout"},{"name":"previewout"}]},"ai":{"NCEs":1,"NN_config":{"NN_family":"mobilenet","confidence_threshold":0.5,"output_format":"detection"},"blob0_size":14477056,"blob1_size":0,"calc_dist_to_bb":true,"camera_input":"rgb","cmx_slices":14,"keep_aspect_ratio":true,"num_stages":1,"shaves":14},"app":{"enable_reconfig":true,"sync_sequence_numbers":false,"sync_video_meta_streams":false,"usb_chunk_KiB":64},"board":{"clear-eeprom":false,"left_fov_deg":71.86000061035156,"left_to_rgb_distance_m":0.019999999552965164,"left_to_right_distance_m":0.09000000357627869,"name":"","override-eeprom":false,"revision":"","rgb_fov_deg":68.7938003540039,"stereo_center_crop":false,"store-to-eeprom":false,"swap-left-and-right-cameras":true},"camera":{"mono":{"fps":30.0,"resolution_h":720,"resolution_w":1280},"rgb":{"fps":30.0,"resolution_h":1080,"resolution_w":1920}},"depth":{"depth_limit_mm":10000,"lr_check":false,"median_kernel_size":7,"padding_factor":0.30000001192092896,"warp_rectify":{"edge_fill_color":0,"mirror_frame":true,"use_mesh":false}},"ot":{"confidence_threshold":0.5,"max_tracklets":20}}
    size of input string json_config_obj to config_h2d is ->1654
    size of json_config_obj that is expected to be sent to config_h2d is ->1048576
    Attempting to open stream config_h2d
    Successfully opened stream config_h2d with ID #1!
    Writing 1048576 bytes to config_h2d
    !!! XLink write successful: config_h2d (1048576)
    Closing stream config_h2d: ...
    Closing stream config_h2d: DONE.
    Creating observer stream host_capture: ...
    Attempting to open stream host_capture
    Successfully opened stream host_capture with ID #0!
    Creating observer stream host_capture: DONE.
    Read: 14477056
    Attempting to open stream inBlob
    Successfully opened stream inBlob with ID #1!
    Writing 14477056 bytes to inBlob
    !!! XLink write successful: inBlob (14477056)
    Closing stream inBlob: ...
    Closing stream inBlob: DONE.
    depthai: done sending Blob file /Users/chrisfranklin/depthai/resources/nn/mobilenet-ssd/mobilenet-ssd.blob.sh14cmx14NCE1
    Attempting to open stream outBlob
    Successfully opened stream outBlob with ID #2!
    Closing stream outBlob: ...
    Closing stream outBlob: DONE.
    Input layer :
    Name: data
    Index: 0
    Element type: uint8
    Element size: 1byte
    Offset: 0 byte
    Dimensions: [Batch : 1, Channel : 3, Height : 300, Width : 300]

    Output layer :
    Name: detection_out
    Index: 0
    Element type: float16
    Element size: 2 bytes
    Offset: 0 byte
    Dimensions: [Batch : 1, Channel : 1, Height : 100, Width : 7]

    CNN to depth bounding-box mapping: start(318, 38), max_size(643, 643)
    Host stream start:metaout
    Opening stream for read: metaout
    Attempting to open stream metaout
    Successfully opened stream metaout with ID #1!
    Starting thread for stream: metaout
    Host stream start:previewout
    Opening stream for read: previewout
    Attempting to open stream previewout
    Started thread for stream: metaout
    Successfully opened stream previewout with ID #2!
    Starting thread for stream: previewout
    depthai: INIT OK!
    Started thread for stream: previewout

    Hi @DMS-1 ,

    Very interesting. Reviewing the logs. Will circle back in just a second.

    From the logs, I think it is this issue @DMS-1 that we just now figured out:

    https://discuss.luxonis.com/d/95-video-preview-window-fails-to-appear-on-macos

    So can you try running this?

    python3 -m pip install opencv-python --force-reinstall --no-cache-dir

    Szabi things he knows the root cause, but it seems like running this is fixing the same issue on other Macs that shows the same issue of the preview not coming up.

    So the reason I think it's this, if OAK is having a problem, it will scream error messages at you. And I don't see any errors at all actually. So I think it's just the window not showing up.

    Thoughts?

    Thanks (and sorry about the delay),
    Brandon

    Hello Brandon, I read your post plus the other post you included via the link. It worked, I think. Yes, it does work, but before I tried your code, I uninstalled Tensorflow before I tried your code. Either way, IT WORKED! What a wonderful device OAK-D. Now I need to see if I can get it to work on my iMac. Thank you for your time and effort! Have a Blessed Day!

    Hi @DMS-1 !

    Thank you for following up and for the kind words! Very excited to see what you build with OAK!

    Have a Blessed Day as well!

    Best,
    Brandon