This s the script that works okay, when I add the NN node to the pipeline is when it's crashing. Could it be that the PoE switch that I'm using doesn't support 1000 Mbps? It only supports 10/100 Mbps
import cv2
import sys
import depthai as dai
import blobconverter
from typing import List
# Check if the MX ID is provided as an argument
if len(sys.argv) < 2:
print("Usage: python capture_image.py <device_mxid>")
sys.exit(1)
# Get the MX ID from the command-line argument
device_mxid = sys.argv[1]
# Function to create a pipeline to capture RGB images
def create_pipeline():
# Create a pipeline
pipeline = dai.Pipeline()
## When I uncomment this lines in my pipeline it causes the crash
# nn_path = blobconverter.from_zoo(name="mobilenet-v3-small-1.0-224-tf", shaves=6)
# model_nn = pipeline.create(dai.node.NeuralNetwork)
# model_nn.setBlobPath(nn_path) # Provide the path to your custom model
# Define a source - color camera
cam_rgb = pipeline.create(dai.node.ColorCamera)
cam_rgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
# Create an output stream
xout_rgb = pipeline.create(dai.node.XLinkOut)
xout_rgb.setStreamName("rgb")
cam_rgb.video.link(xout_rgb.input)
return pipeline
# Discover devices and select the one with the specified MX ID
infos: List[dai.DeviceInfo] = dai.DeviceBootloader.getAllAvailableDevices()
if len(infos)>0:
for info in infos:
if info.getMxId() == device_mxid:
print(f"Found device with MX ID: {device_mxid}")
# Create a pipeline
pipeline = create_pipeline()
# Connect to the device
with dai.Device(pipeline, info) as device:
# Output queue for RGB frames
q_rgb = device.getOutputQueue(name="rgb", maxSize=4, blocking=True)
# Get the RGB frame from the output queue (this captures one frame)
in_rgb = q_rgb.get() # Blocking call, waits for a frame
# Convert the frame to a format OpenCV can use (BGR)
frame = in_rgb.getCvFrame()
# Save the frame as an image
image_path = f"luxonis_image_{device_mxid}.png"
cv2.imwrite(image_path, frame)
print(f"Image saved at: {image_path}")
else:
print(f"No devices found with MX ID: {device_mxid}")
else:
print("No devices found!!")