depthai icon indicating copy to clipboard operation
depthai copied to clipboard

[BUG] Can't change FPS on OAK-D-Lite

Open domef opened this issue 3 years ago • 17 comments

I can't change the FPS on the OAK-D-Lite (but I can on OAK-D).

I used the code from here and i added the highlighed lines:

#!/usr/bin/env python3

import cv2
import depthai as dai

# Create pipeline
pipeline = dai.Pipeline()

# Define source and output
camRgb = pipeline.create(dai.node.ColorCamera)
xoutRgb = pipeline.create(dai.node.XLinkOut)

xoutRgb.setStreamName("rgb")

# Properties
camRgb.setPreviewSize(300, 300)
camRgb.setInterleaved(False)
camRgb.setColorOrder(dai.ColorCameraProperties.ColorOrder.RGB)

# -------------------- ADDED LINES --------------------
print(f"FPS before: {camRgb.getFps()}")
camRgb.setFps(60)
print(f"FPS after: {camRgb.getFps()}")
# -----------------------------------------------------

# Linking
camRgb.preview.link(xoutRgb.input)

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

    print("Connected cameras: ", device.getConnectedCameras())
    # Print out usb speed
    print("Usb speed: ", device.getUsbSpeed().name)

    # Output queue will be used to get the rgb frames from the output defined above
    qRgb = device.getOutputQueue(name="rgb", maxSize=4, blocking=False)

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

        # Retrieve 'bgr' (opencv format) frame
        cv2.imshow("rgb", inRgb.getCvFrame())

        if cv2.waitKey(1) == ord("q"):
            break

I tested the same code with OAK-D and OAK-D-Lite. After setting the new value for fps, the output of camRgb.getFps() is the same for both the devices, but only the OAK-D actually changes the fps, whereas the OAK-D-Lite doesn't change the fps.

domef avatar Jan 31 '22 15:01 domef

Sorry about the trouble. Yes, I think OAK-D-Lite FPS is locked right now as a result of an underlying implementation bug or lacking.

Will circle back.

Luxonis-Brandon avatar Jan 31 '22 16:01 Luxonis-Brandon

This is not implemented yet, but work in progress (RGB only for now) on the branch cfg_fps_lite (current commit). IMX214 is capable of 1080p@60fps, but at the moment the camera configs we use are limiting the FPS to:

  • 0.735 .. 35 for 1080p
  • 1.4 .. 28.5 (TODO why not 30) for 4K/12MP/13MP

Also note here the pipeline is just statically configured on the host system, there is no interaction with the device and the device type is not known:

print(f"FPS before: {camRgb.getFps()}")
camRgb.setFps(60)
print(f"FPS after: {camRgb.getFps()}")

Only at this point it reaches the device: with dai.Device(pipeline) as device: and warnings should be printed on OAK-D Lite that FPS change is not implemented (note the warning wasn't removed yet on the branch cfg_fps_lite).

alex-luxonis avatar Jan 31 '22 17:01 alex-luxonis

Is there a schedule for this to be supported officially? Would be really nice having color and depth @ 60fps

JojoDevel avatar Feb 24 '22 22:02 JojoDevel

35 FPS seems to work for color on OAK-D Lite with new release 2.15.0 https://github.com/luxonis/depthai-python/releases/tag/v2.15.0.0 :+1: However, mono FPS change is is still not implemented.

JojoDevel avatar Feb 26 '22 20:02 JojoDevel

@JojoDevel We should get configurable and higher FPS for OV7251 mono (at least 60 fps) in about 2 weeks. Then need to look on getting better configs for IMX214 color to achieve 60fps at 1080p. For OV7251, 200 FPS will also be supported (was tested experimentally), but we need some more work on lowering the 3A calculation rate (every N frames) at this high FPS.

alex-luxonis avatar Feb 26 '22 21:02 alex-luxonis

That sounds amazing :rocket: Looking very much forward to that :+1:

JojoDevel avatar Feb 26 '22 22:02 JojoDevel

@alex-luxonis Any news on higher framerates?

JojoDevel avatar Mar 20 '22 00:03 JojoDevel

@alex-luxonis any progress on the fps?

JojoDevel avatar Apr 19 '22 08:04 JojoDevel

@JojoDevel Apologies for the delay, it's implemented now on https://github.com/luxonis/depthai-python/pull/566

alex-luxonis avatar Apr 21 '22 20:04 alex-luxonis

I installed depthai-2.17.3.1, but with OAK-D Lite but I get [18443010C1818F0E00] [1.1] [141.182] [system] [warning] ColorCamera IMX214: capping FPS for selected resolution to 35.

domef avatar Sep 08 '22 09:09 domef

For IMX214, the camera configs still have the FPS limitations mentioned in the comment above: https://github.com/luxonis/depthai/issues/624#issuecomment-1026029818

alex-luxonis avatar Sep 16 '22 13:09 alex-luxonis

Will ever be possible to have more fps on IMX214M?

domef avatar Sep 16 '22 13:09 domef

Hi, I got the same issue on OAK-D Lite after I ran the examples/Yolo/tiny_yolo.py [1844301041180E1300] [20.1] [398.391] [system] [warning] ColorCamera IMX214: capping FPS for selected resolution to 35 The first time I ran the examples/ColorCamera/rgb_preview.py it approached 60 FPS and no warning came out. Then I ran the examples/Yolo/tiny_yolo.py and the warning came out After that, I ran the examples/ColorCamera/rgb_preview.py again and the warning was still there and FPS can't be up to 60

li195111 avatar Oct 13 '22 01:10 li195111

@li195111 how did you calculate the FPS it approached?

brentonjackson avatar Nov 28 '22 18:11 brentonjackson

@brentonjackson I use count / (time.monotonic() - start_time)

li195111 avatar Jan 17 '23 08:01 li195111

Hi all. I understand then that the OAK D Lite cannot be set to 60 fps for the RGB camera then?

BiomechatronicsRookie avatar Jun 15 '23 15:06 BiomechatronicsRookie

@BiomechatronicsRookie

Hi all. I understand then that the OAK D Lite cannot be set to 60 fps for the RGB camera then?

Correct - for RGB, 35FPS is the limit - for the time being

themarpe avatar Jun 19 '23 17:06 themarpe