IntelRealSense / librealsense

Intel® RealSense™ SDK
https://www.intelrealsense.com/
Apache License 2.0
7.53k stars 4.81k forks source link

pipeline.start(config) RuntimeError: Couldn't resolve requests when increasing depth stream resolution to 1920x1080 #13355

Open monajalal opened 3 days ago

monajalal commented 3 days ago

When I change the resolution of depth camera, I get this error, however, I need the resolution of my depth camera to match resolution of my color camera. Could you please provide a fix?

# Get device product line for setting a supporting resolution
pipeline_wrapper = rs.pipeline_wrapper(pipeline)
pipeline_profile = config.resolve(pipeline_wrapper)
device = pipeline_profile.get_device()
device_product_line = str(device.get_info(rs.camera_info.product_line))

found_rgb = False
for s in device.sensors:
    if s.get_info(rs.camera_info.name) == 'RGB Camera':
        found_rgb = True
        break
if not found_rgb:
    print("The demo requires Depth camera with Color sensor")
    exit(0)

config.enable_stream(rs.stream.depth, 1920, 1080, rs.format.z16, 30)

config.enable_stream(rs.stream.color, 1920, 1080, rs.format.bgr8, 30)
# Start streaming
pipeline.start(config)

    pipeline.start(config)
RuntimeError: Couldn't resolve requests

Required Info
Camera Model { R200 / F200 / SR300 / ZR300 / D400 }
Firmware Version (Open RealSense Viewer --> Click info)
Operating System & Version {Win (8.1/10) / Linux (Ubuntu 14/16/17) / MacOS
Kernel Version (Linux Only) (e.g. 4.14.13)
Platform PC/Raspberry Pi/ NVIDIA Jetson / etc..
SDK Version { legacy / 2.<?>.<?> }
Language {C/C#/labview/nodejs/opencv/pcl/python/unity }
Segment {Robot/Smartphone/VR/AR/others }

Issue Description

<Describe your issue / question / feature request / etc..>

MartyG-RealSense commented 3 days ago

Hi @monajalal RealSense cameras do not support a depth resolution of 1920x1080 - it is only supported for RGB. This is why the error RuntimeError: Couldn't resolve requests occurs, because the requested depth resolution cannot be provided. The maximum depth resolution available is 1280x720 or 1280x800. So there is no solution available that will provide 1920x1080 depth, unfortunately.

Is it possible for you to use 1280x720 for RGB, please?

monajalal commented 3 days ago

That works but for my application I need 1920x1080 for color (I only need to match depth so that I know if a person is far away or too close).

I don't think this part of code is correct still but I was using

        for result in results:
            for box in result.boxes:
                x1 = int(box.xyxy[0][0])
                y1 = int(box.xyxy[0][1])
                x2 = int(box.xyxy[0][2])
                y2 = int(box.xyxy[0][3])
                # x1, y1, x2, y2 = map(int, box.xyxy)
                # Grab depth information from the center of the bounding box
                depth_value = depth_image[(y2 + y1) // 2, (x2 + x1) // 2]
                print(f"Detected object at depth: {depth_value}")

Hence if the resolutions are not same it throws error.

Is there any other options you would suggest?

box is coming from yolov10x from ultralytics

MartyG-RealSense commented 3 days ago

Would using a single combined image generated with depth to color alignment instead of having separate depth and color images be an option for you?

monajalal commented 3 days ago

@MartyG-RealSense I am not sure what that means, can you please show an example?

I need to show the color image to user. I only need the depth feed to tell how far the person is

MartyG-RealSense commented 3 days ago

Here are some example programs demonstrating depth to color alignment.

C++ https://github.com/IntelRealSense/librealsense/tree/master/examples/align

Python https://github.com/IntelRealSense/librealsense/blob/master/wrappers/python/examples/align-depth2color.py

If you installed the librealsense SDK on Linux with the example programs included in the installation then you should be able to find a pre-built executable version of rs-align in the folder usr/local/bin