- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
# encoding:utf-8
import numpy as np
import cv2
import pyrealsense2 as rs
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.color, 640, 480, rs.format.rgb8, 30)
config.enable_stream(rs.stream.depth,640, 480, rs.format.z16, 30)
# 深度存储为每像素一个无符号 16 位整数,在摄像机特定单位中线性映射到深度
pipeline.start(config)
while True:
frames = pipeline.wait_for_frames()
color = frames.get_color_frame()
depth = frames.get_depth_frame()
if (not depth) or (not color):
print("Color or Depth not available!")
break
# color
color_img = np.asanyarray(color.get_data())
color_img = cv2.cvtColor(color_img, cv2.COLOR_BGR2RGB)
# depth
c = rs.colorizer()
colorized_depth = np.asanyarray(c.colorize(depth).get_data())
# pointclouds I HAVE PROBLEMS HERE??????
pc = rs.pointcloud()
points = pc.calculate(depth)
pc.map_to(color)
app_state.tex.upload(color) ?
draw_pointcloud(app, app_state, points) How to show the pointcloud?
cv2.imshow("color",color_img)
cv2.imshow("depth",colorized_depth)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
pipeline.stop()
- Tags:
- Cloud Computing
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Only one thread please. Stay with your other thread:
Doc
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page