Closed compscidr closed 4 years ago
Was playing around with this a bit more today - if you get or set the ROI before you start the pipeline it doesn't freeze, but if you try to set the ROI after the pipeline has started, it freezes.
Hi @compscidr I'm having trouble reproducing this... Running MacOS 10.13.6 with 5.12 firmware and 2.31 SDK and the Viewer. Do you see this only in python or also when trying to use this functionality in Viewer / C++?
So far only on python. Will try today with C++. Viewer seems to work fine, so I assume c++ will as well.
I'll try to check python as well... Perhaps something to do with python global lock... :/
Confirmed it is not occurring in c++
Please try to upgrade to new version. The following code works in my laptop (macOS 10.15.3, python3)
import pyrealsense2 as rs2 import time
ctx = rs2.context() pipe = rs2.pipeline(ctx)
pp = pipe.start()
for sensor in pp.get_device().sensors: if sensor.is_depth_sensor(): print("DEPTH SENSOR") else: print("RGB SENSOR") roi_sensor = sensor.as_roi_sensor() print(roi_sensor) time.sleep(0.1) roi = roi_sensor.get_region_of_interest() time.sleep(0.1) print("BEFORE SET (",roi.min_x, ", ", roi.min_y, ") - (", roi.max_x, ", ", roi.max_y, ")") roi.min_x = roi.min_y = 100 roi.max_x = roi.max_y = 200 roi_sensor.set_region_of_interest(roi) time.sleep(0.1) roi = roi_sensor.get_region_of_interest() time.sleep(0.1) print("AFTER SET (",roi.min_x, ", ", roi.min_y, ") - (", roi.max_x, ", ", roi.max_y, ")") time.sleep(0.1)
pipe.stop()
Just tried it, seems to be working - had to modify it a bit because it start the pipeline without a config - for future reference for anyone else - this is what I had to get it to work:
#! /usr/bin/python3
import pyrealsense2 as rs2
import time
ctx = rs2.context()
pipe = rs2.pipeline(ctx)
devices = {d.get_info(rs2.camera_info.serial_number): d for d in ctx.query_devices()}
device_id, device = devices.popitem()
rsconfig = rs2.config()
rsconfig.enable_device(str(device_id))
rsconfig.enable_stream(rs2.stream.color, 1920, 1080, rs2.format.any, 30)
rsconfig.enable_stream(rs2.stream.depth, 1280, 720, rs2.format.any, 30)
rsconfig.enable_stream(rs2.stream.infrared, 1, 1280, 720, rs2.format.any, 30)
rsconfig.enable_stream(rs2.stream.infrared, 2, 1280, 720, rs2.format.any, 30)
pp = pipe.start(rsconfig)
for sensor in pp.get_device().sensors:
if sensor.is_depth_sensor():
print("DEPTH SENSOR")
else:
print("RGB SENSOR")
roi_sensor = sensor.as_roi_sensor()
print(roi_sensor)
time.sleep(0.1)
roi = roi_sensor.get_region_of_interest()
time.sleep(0.1)
print("BEFORE SET (",roi.min_x, ", ", roi.min_y, ") - (", roi.max_x, ", ", roi.max_y, ")")
roi.min_x = roi.min_y = 100
roi.max_x = roi.max_y = 200
roi_sensor.set_region_of_interest(roi)
time.sleep(0.1)
roi = roi_sensor.get_region_of_interest()
time.sleep(0.1)
print("AFTER SET (",roi.min_x, ", ", roi.min_y, ") - (", roi.max_x, ", ", roi.max_y, ")")
time.sleep(0.1)
pipe.stop()
Thanks for the help!
Have checked out for other issues, and looked through lots of example code.
Issue Description
Having problems setting and getting the ROI from the RGB and Depth sensors. The code is working fine when I run it on Ubuntu, however with MacOS, it freezes at the lines where I try to get or set the sensor ROI. Doesn't seem to matter if I only do one sensor, or the other, or both.
Here is the relevant code lines stripped from a larger script:
Just curious if this is because not all the stuff for macOS is done yet, or if there is a bug? If there is a bug, if someone can point into the right direction, I don't mind submitting a PR.