You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comment an invalid operation statement, such as using OpenCV to display colormap
Load data with an empty list and add data to the list using methods append or insert, for example, res=[]; res.append(depth_image)
Read the image data through two separate threads and add it to the final result
Create a FIFO queue using queue.Queue() and return the res
Change the different wait times in pipeline.wait_for_frames()
Run into the same problem using these methods, they're similar
Traceback (most recent call last):
File ".\src\realsense\save_data.py", line 17, in
frames = pipeline.wait_for_frames()
RuntimeError: Frame didn't arrive within 5000
I made sure that my RealSense was connected to the computer correctly, and I used the original data cable. RealSense work fine in the Intel RealSense Viewer and are displayed over the USB3.2 cable connection.
When I comment out the code that saves the image, the error goes away (for example, comment line 28 of the instance file). This error occurs during the 15th for loop, and you can see through the debuger that the program works normally during the previous loops.
The error demonstration code is as follows
import pyrealsense2 as rs
import cv2
import numpy as np
import time
import tqdm
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.depth, 0, 848, 100, rs.format.z16, 300)
pipeline.start(config)
cv2.namedWindow('RealSense', cv2.WINDOW_AUTOSIZE)
num = 1000
res = [None for i in range(num)]
for i in tqdm.tqdm(range(num)):
frames = pipeline.wait_for_frames()
depth_frame = frames.get_depth_frame()
if not depth_frame:
continue
depth_image = np.asanyarray(depth_frame.get_data())
depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(
depth_image, alpha=0.085), cv2.COLORMAP_JET)
cv2.imshow('RealSense', depth_colormap)
cv2.waitKey(1)
res[i] = depth_image
cv2.destroyAllWindows()
np.savez_compressed("realsense", *res)
The text was updated successfully, but these errors were encountered:
Ligcox
changed the title
High-speed mode save image mode
D435i camera high-speed mode save depth data to .npz files
Jun 19, 2021
Hi @Ligcox When an append operation in a Python script in librealsense fails after the 15th frame, it is typically due to a limitation on saving frames into a collection.
A solution that has worked for RealSense users who experience this issue is to store the frames in memory using the SDK's Keep() function. The links below have examples of Python code for Keep():
errorexample.txt
Issue Description
I tried to use the D435i high-speed mode(https://dev.intelrealsense.com/docs/high-speed-capture-mode-of-intel-realsense-depth-camera-d435) to record the image data and write them to the .npz file. The program ran into problems when I tried to add data to a variable in the for loop. I tried the following
Run into the same problem using these methods, they're similar
Traceback (most recent call last):
File ".\src\realsense\save_data.py", line 17, in
frames = pipeline.wait_for_frames()
RuntimeError: Frame didn't arrive within 5000
I made sure that my RealSense was connected to the computer correctly, and I used the original data cable. RealSense work fine in the Intel RealSense Viewer and are displayed over the USB3.2 cable connection.
When I comment out the code that saves the image, the error goes away (for example, comment line 28 of the instance file). This error occurs during the 15th for loop, and you can see through the debuger that the program works normally during the previous loops.
The error demonstration code is as follows
The text was updated successfully, but these errors were encountered: