Set ROI for RGB Kamera in Python D455
Hello, I am using a D455 camera in my project. I know that in the RealSense Viewer, one can set the ROI (Region of Interest) for the IR cameras and the RGB camera separately. I have managed to set the ROI for the IR camera, but I can't find a solution to set the ROI of the RGB camera through my Python script. Is it possible to set the ROI for the RGB camera in Python? I can load a configuration in advanced mode if that helps.
Thanks Arne
-
Hi Arne Luken The best available reference for defining a ROI, including one for the RGB sensor, using Python code is at the link below.
-
Hey, i tried that:
Traceback (most recent call last):
File "/media/tec/SSDOrin/yolov8/roi_tst copy.py", line 17, in <module>
roi_sensor.set_region_of_interest(sensor_roi)
RuntimeError: hwmon command 0x75( b4 21c 140 3c0 ) failed (response -6= Invalid parameter)import pyrealsense2 as rs
config = rs.config()config.enable_stream(rs.stream.color, 1280, 720, rs.format.rgb8, 30)config.enable_stream(rs.stream.depth, 848, 480, rs.format.z16, 30)
pipeline = rs.pipeline()profile = pipeline.start(config)dev = profile.get_device()for sensor in dev.sensors:if sensor.is_color_sensor():roi_sensor = sensor.as_roi_sensor()
sensor_roi = roi_sensor.get_region_of_interest()sensor_roi.min_x, sensor_roi.max_x = 320, 960sensor_roi.min_y, sensor_roi.max_y = 180, 540roi_sensor.set_region_of_interest(sensor_roi)
Please sign in to leave a comment.
Comments
6 comments