Hutch07

- 2 Jan
- Joined Jun 21, 2023
- 0 best answers
I have 2 cameras that were running fine. There were no changes to the code and now have this error
Exception has occurred: RuntimeError
- Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND
I have been getting a warning about DeprecationWarning: Use constructor taking 'UsbSpeed' instead
device = stack.enter_context(dai.Device(openvino_version, device_info, usb2_mode))
I do not see information on how to use UsbSpeed. m Do I set it to "High"?
- Edited
This will take a bit. I need approval…
Yes - I am running it today
That absolutely worked. I updated my def create_pipeline(cam_list) in the file and took out the "cam" loop to make it a bit simpler.
Thank You Jaka!
Hutch
- Edited
This code starts 2 pipelines for 2 OAK-D cameras but sending the manual exposure has no effect on the cameras. They stay in auto-exposure mode.
When I use the depthai_sdk, I do not have a problem setting the exposure and can save the video.
When I use depthai like in "luxonis/depthai-experiments/blob/master/gen2-syncing/host-multiple-OAK-sync.py"
I can sync the images but setting the exposure seems to do nothing.
The Mono Camera exposure control example works with a single camera. "https://docs.luxonis.com/projects/api/en/latest/samples/MonoCamera/mono_camera_control/#mono-camera-control"
If anyone can give me a hint on how to set the exposure with a pipeline, I think the modifications to host-multiple-OAK-sync.py would work. The motion blur I am getting will not work with auto exposure.
- Edited
"luxonis/depthai-experiments/blob/master/gen2-syncing/host-multiple-OAK-sync.py"
works fine. I will save each frame as a file with frame-count in the name. Then I can save a CSV file with frame-count, IMU data, timestamps. I think somehow saving video would be faster.
:No MCAP will not work. Only VIDEO
- Edited
jakaskerl ROSAG also fails.
Exception has occurred: ModuleNotFoundError
No module named 'rosbags'
File "D:\Programming\OAK_D\M_exp_rec.py", line 40, in <module> oakL.record([ left.out.encoded, right.out.encoded], out_path, RecordType.ROSBAG) ModuleNotFoundError: No module named 'rosbags'
- Edited
I have tried several examples from the depthai and depthai-sdk (https://docs.luxonis.com/projects/sdk/en/latest/samples/recording/SDK_mcaprecord/) and if the RecordType is MCAP or ROSBAG they fail with Module Not Found Error no module mcap_ros1. They will work if the RecordType is VIDEO. I am trying to record IMU data and I am not sure if the IMU data will be encoded in the VIDEO format.
I am using:
- depthai-sdk 1.13.1
- depthai 2.22.0.0
- Windows 10
Error here is "No module named mcap_ros1
- Edited
IMU Example from here: https://docs.luxonis.com/projects/sdk/en/latest/samples/recording/SDK_mcap_record_imu/
FYI - Pasting code seems impossible on this site.
My python file is here:
I also modified the camera_control.py in the SDK to add : def set_exposure_iso(self, exposure, iso):
I would like to synchronize my 2 Oak-D Pros and record the video (CAMB and CAM_C only) with the IMU information for each frame (15 FPS) exported to a CSV. This was going well until I added adjusting the exposure of each camera. I had to upgrade the depthai-SDK to 1.13 for the exposure and now the reworked example code for record.py needs a major overhaul. It was written for depthai-sdk 1.2.
Can you suggest psudo code (or actual) on how to record these synchronized 2 streams with IMU info?
Have you looked at the camera_control.py in the SDK?
Thanks jakaskerl I was also trying replay but it turns out that I was not closing my cameras in the code I was using to record the video. I changed the recording code to this:
Thanks again for your help.
- Edited
My code I am using to record the video is :
left = oak.create_camera('left', resolution='720p', fps=20, encode='H265') right = oak.create_camera('right', resolution='720p', fps=20, encode='H265') # Synchronize & save all (encoded) streams oakR =OakCamera("1844301081B8AC0F00") leftR = oakR.create_camera('left', resolution='720p', fps=20, encode='H265') rightR = oakR.create_camera('right', resolution='720p', fps=20, encode='H265') oak.record([ left.out.encoded, right.out.encoded], out_path, RecordType.VIDEO) oakR.record([ leftR.out.encoded, rightR.out.encoded], out_path, RecordType.VIDEO)`
The code I am trying to use to open the mp4 file is:
from depthai_sdk import OakCamera with OakCamera(recording='E:\\Junk\\vid\\1-1844301081B8AC0F00\\CAM_B_bitstream.mp4') as oak:
left =oak.create_camera('left', resolution='720p', fps=20, encode='H265')
oak.visualize([left.out.camera], scale=2/3, fps=True)
oak.visualize(left.out, fps=True)
oak.start(blocking=True)
My error is this :
Exception has occurred: TypeError
OakCamera.init() got an unexpected keyword argument 'recording'
File "D:\Programming\OAK_D\replaysdk.py", line 2, in <module>
with OakCamera(recording='E:\Junk\vid\1-1844301081B8AC0F00\CAM_B_bitstream.mp4') as oak:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: OakCamera.init() got an unexpected keyword argument 'recording'- Edited
How can I view or decode an mp4 video? I have the camera recording OK but have not found anything that can open it.
from depthai_sdk import OakCamera, RecordType
from multiprocessing.sharedctypes import Value
import depthai as dai
import contextlib
import math
import time, datetime
from pathlib import Path
import signal
import threading
import csv
out_path = r"E:\Junk\vid"
OUTPUT_DIR = Path(r"F:\CAMERAS")
Output_csv = Path.joinpath(OUTPUT_DIR, "CSV")
print("Output", Output_csv)
def write_times(outime, big_array):
print("Writing Timestamp CSV.")
outname = outime.replace(":", "_") + ".csv"
outfile = Path.joinpath(Output_csv, outname)
header = ["Device", "Cam", "Timestamp"]
with open(outfile,"w", newline='') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=',')
spamwriter.writerow(header)
for rowi in big_array:
spamwriter.writerow(rowi)
return True
with OakCamera() as oak:
left = oak.create_camera('left', resolution='800p', fps=20, encode='H265')
right = oak.create_camera('right', resolution='800p', fps=20, encode='H265')
# Synchronize & save all (encoded) streams
oak.record([ left.out.encoded, right.out.encoded], out_path, RecordType.VIDEO)
# Show left stream
oak.visualize([left.out.camera], scale=2/3, fps=True)
oak.start()
left.control.set_exposure_iso(1500, 600)
while oak.running():
key = oak.poll()
if key == ord('i'):
left.control.exposure_time_down()
elif key == ord('o'):
left.control.exposure_time_up()
elif key == ord('k'):
left.control.sensitivity_down()
elif key == ord('l'):
left.control.sensitivity_up()
elif key == ord('e'): # Switch to auto exposure
left.control.send_controls({'exposure': {'auto': True}}
[upl-image-preview url=https://discuss.luxonis.com/assets/files/2023-09-09/1694286258-701158-image.png]