luxonis / depthai-core

DepthAI C++ Library
MIT License
238 stars 128 forks source link

[BUG] The issue of output image of OAK-1-W sensor with 400P resolution #1145

Open cjh1995-ros opened 1 month ago

cjh1995-ros commented 1 month ago

Describe the bug A clear and concise description of what the bug is. Currently, I'm working on OAK-1-W-97 with OV9782. In the doc, it supports 400P, 720P, 800P. So I try to test every resolution and 720P and 800P work fine, but 400P gave me the following result.

Screenshot from 2024-10-07 13-28-21

I tested it with following code.

import depthai as dai
import cv2

pipeline = dai.Pipeline()

# Define sources and outputs
camRgb: dai.node.Camera = pipeline.create(dai.node.Camera)

#Properties
camRgb.setBoardSocket(dai.CameraBoardSocket.CAM_A)
camRgb.setSize((640, 400))

# Linking
videoOut = pipeline.create(dai.node.XLinkOut)
videoOut.setStreamName("video")
camRgb.video.link(videoOut.input)

ispOut = pipeline.create(dai.node.XLinkOut)
ispOut.setStreamName("isp")
camRgb.isp.link(ispOut.input)

with dai.Device(pipeline) as device:
    video = device.getOutputQueue(name="video", maxSize=1, blocking=False)
    isp = device.getOutputQueue(name="isp", maxSize=1, blocking=False)

    while True:
        if video.has():
            cv2.imshow("video", video.get().getCvFrame())
        if isp.has():
            cv2.imshow("isp", isp.get().getCvFrame())
        if cv2.waitKey(1) == ord('q'):
            break

For additional test, here's the result of depthai-viewer. Idk why the following log came out.

[18443010C1D9E4F400] [3.3.2.1] [1.634] [ColorCamera(0)] [warning] Unsupported resolution set for detected camera OV9782, needs 800_P or 720_P. Defaulting to 800_P
Couldn't start pipeline:  ColorCamera(0) - 'video' width or height (1920, 1080) bigger than maximum at current sensor resolution (1280, 800)
[2024-10-07T05:55:06Z ERROR re_viewer::depthai::depthai] Error: Couldn't start pipeline
Selecting device:  
Resetting...
Closing device...
Done
jakaskerl commented 1 month ago

I think the issue is that older calibrations store ov9782 as being able to output both mono and color: socket: CAM_A, sensorName: OV9782, width: 1280, height: 800, orientation: AUTO, supportedTypes: [COLOR, MONO]. We can fix it by changing the calibration or to fix in FW. cc @SzabolcsGergely

cjh1995-ros commented 1 month ago

@jakaskerl So do I need to calibrate the camera with chessboard?

jakaskerl commented 1 month ago

Hi @cjh1995-ros Afaik the device needs to be reflashed completely (not possible through recalibration). Best to wait for FW fix.

Workaround:

camRgb.setSize((1280, 800))
camRgb.setVideoSize((640, 400))
cjh1995-ros commented 1 month ago

Thanks @jakaskerl. It worked!

cjh1995-ros commented 1 month ago

Hi @cjh1995-ros Afaik the device needs to be reflashed completely (not possible through recalibration). Best to wait for FW fix.

Workaround:

camRgb.setSize((1280, 800))
camRgb.setVideoSize((640, 400))

Sorry that I closed the issue. I just checked and it works. However, fov is decreased so hard. Guess it cropped the undistorted image. Here's the results. Is there any way to resize the image in the Camera node?

(setSize - serVideoSize) 800P - 400P 1

800P - 800P 2

400P - 400P 3

cjh1995-ros commented 1 month ago

Hi @cjh1995-ros Afaik the device needs to be reflashed completely (not possible through recalibration). Best to wait for FW fix.

@jakaskerl Then how long should I wait for the FW update?

lturing commented 1 month ago

@jakaskerl I meet the same question, how long will update the FW? many thanks