Given the following MWE if I try to start a color Stream I get the following error:
INFO:pyrealsense.core:There are 1 connected RealSense devices.
INFO:pyrealsense.core:Using device 0, an Intel RealSense ZR300
INFO:pyrealsense.core: Serial number: 3511803250
INFO:pyrealsense.core: Firmware version: 2.0.71.28
ERROR:pyrealsense.utils:rs_error was raised when calling rs_get_frame_data(device:0xf1ca90, stream:COLOR)
ERROR:pyrealsense.utils: streaming not started!
Traceback (most recent call last):
File "custom_stream.py", line 42, in <module>
a = dev.irl
File "build/bdist.linux-x86_64/egg/pyrealsense/core.py", line 518, in <lambda>
File "build/bdist.linux-x86_64/egg/pyrealsense/core.py", line 514, in get_stream_data
File "build/bdist.linux-x86_64/egg/pyrealsense/utils.py", line 46, in _check_error
pyrealsense.utils.RealsenseError: rs_get_frame_data(device:0xf1ca90, stream:COLOR) crashed with: streaming not started!
MWE:
import logging
logging.basicConfig(level=logging.INFO)
import ctypes
import time
import numpy as np
import cv2
import pyrealsense as pyrs
from pyrealsense.constants import rs_option
class IRStreamR(pyrs.stream.Stream):
def __init__(self, name='irl',
native=True,
#stream=pyrs.constants.rs_stream.RS_STREAM_INFRARED,
stream=pyrs.constants.rs_stream.RS_STREAM_COLOR,
width=640,
height=480,
format=pyrs.constants.rs_format.RS_FORMAT_Y8,
fps=30):
super(IRStreamR, self).__init__(name, native, stream, width, height, format, fps)
self.shape = (height, width, 1)
self.dtype = ctypes.c_uint8
with pyrs.Service() as serv:
with serv.Device(streams=(IRStreamR(),
)) as dev:
dev.apply_ivcam_preset(0)
try: # set auto exposure to obtain good depth image
custom_options = [(rs_option.RS_OPTION_R200_LR_AUTO_EXPOSURE_ENABLED, True),
(rs_option.RS_OPTION_COLOR_ENABLE_AUTO_EXPOSURE, True),
]
dev.set_device_options(*zip(*custom_options))
except pyrs.RealsenseError:
pass # options are not available on all devices
while True:
dev.wait_for_frames()
a = dev.irl
a = cv2.cvtColor(a, cv2.COLOR_GRAY2BGR)
cv2.imshow('', a)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
If you instead use the line #stream=pyrs.constants.rs_stream.RS_STREAM_INFRARED, it works just fine.
The Idea is to get a Camera stream with a 1920 x 1080 resolution which I am trying to achieve by a custom stream.
Given the following MWE if I try to start a color Stream I get the following error:
MWE:
If you instead use the line
#stream=pyrs.constants.rs_stream.RS_STREAM_INFRARED,
it works just fine.The Idea is to get a Camera stream with a 1920 x 1080 resolution which I am trying to achieve by a custom stream.
Any hints or alternatives welcome