Skip to content

Instantly share code, notes, and snippets.

@fgolemo
Last active February 7, 2019 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fgolemo/1e15dc27a824c43eccff370825b8485e to your computer and use it in GitHub Desktop.
Save fgolemo/1e15dc27a824c43eccff370825b8485e to your computer and use it in GitHub Desktop.
RGB speed test for the Intel RealSense d435i
import time
import numpy as np
import pyrealsense2 as rs
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.color, 640, 480, rs.format.rgb8, 60)
pipeline.start(config)
tests = 100
start = time.time()
for i in range(tests):
frames = pipeline.wait_for_frames()
color = frames.get_color_frame() # Avg 0.0349s per frame, i.e. 28.6321Hz
if not color: continue
diff = (time.time() - start) / tests
print("Avg {}s per frame, i.e. {}Hz".format(np.around(diff, 4), np.around(1 / diff, 4)))
pipeline.stop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment