- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm currently working with a d435 and I want to display IR images (both left and right but for the moments just focus on one), following my code:
import pyrealsense2 as rs
import numpy as np
import cv2
# We want the points object to be persistent so we can display the
#last cloud when a frame drops
points = rs.points()
# Create a pipeline
pipeline = rs.pipeline()
#Create a config and configure the pipeline to stream
config = rs.config()
config.enable_stream(rs.stream.infrared, 1, 1280, 720, rs.format.y8, 30)
# Start streaming
profile = pipeline.start(config)
# Streaming loop
try:
while True:
# Get frameset of color and depth
frames = pipeline.wait_for_frames()
ir1_frame = frames.get_infrared_frame(1) # Left IR Camera, it allows 1, 2 or no input
image = np.asanyarray(ir1_frame)
cv2.namedWindow('IR Example', cv2.WINDOW_AUTOSIZE)
cv2.imshow('IR Example', image)
key = cv2.waitKey(1)
# Press esc or 'q' to close the image window
if key & 0xFF == ord('q') or key == 27:
cv2.destroyAllWindows()
break
finally:
pipeline.stop()
everything works fine till the line:
cv2.imshow('IR Example', image)
I get the error:
TypeError: mat data type = 17 is not supported
so, my question is: how can I display IR images (using cv2 or matplotlib or whatever)?
Hope I was clear since this is my first question.
Cheers
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The link below has a short, simple script for getting the infrared frame with Pyrealsense2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you for the quick reply, but I'm already able to get the infrared frame, what i want to do is to display it on the screen.
Basically what a really want is the IR stream as a matrix and not as a pyrealsense.video_frame object in order to do further manipulations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually i just solved my problem, i just substituted this line:
image = np.asanyarray(ir1_frame)
with this one:
image = np.asanyarray(ir1_frame.get_data())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm very glad you found a solution! :)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page