日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python 调用 Intel realsense D415i摄像头

發布時間:2023/12/20 python 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python 调用 Intel realsense D415i摄像头 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1、搭建python3開發環境(wind10 )

安裝Intel.RealSense.SDK.exe后,在安裝目錄…/Intel RealSense SDK 2.0/bin/x64目錄下有兩個.pyd文件,根據文件名可以知道,其中一個對應python2.7版本,另一個對應python3.6。將python3.6對應的.pyd文件復制到python環境的site-packages目錄下,我的目錄是…/Anaconda3/envs/ycc01/Lib/site-packages。即可完成環境搭建。

這里用python調用的版本一定時python3.6,不然會報錯:ImportError:DLL load failed:找不到指定模塊

2.顯示深度圖與彩色圖

import pyrealsense2 as rs import numpy as np import cv2# Configure depth and color streams pipeline = rs.pipeline() config = rs.config() config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30) config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30)# Start streaming pipeline.start(config)try:while True:# Wait for a coherent pair of frames: depth and colorframes = pipeline.wait_for_frames()depth_frame = frames.get_depth_frame()color_frame = frames.get_color_frame()if not depth_frame or not color_frame:continue# Convert images to numpy arrays 把圖像轉換為numpy datadepth_image = np.asanyarray(depth_frame.get_data())color_image = np.asanyarray(color_frame.get_data())# Apply colormap on depth image (image must be converted to 8-bit per pixel first) 在深度圖上用顏色渲染depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_image, alpha=0.03), cv2.COLORMAP_JET)# Stack both images horizontally 把兩個圖片水平拼在一起images = np.hstack((color_image, depth_colormap))cv2.namedWindow('RealSense', cv2.WINDOW_AUTOSIZE)cv2.imshow('RealSense', images)key = cv2.waitKey(1)if key & 0xFF == ord('q') or key == 27:cv2.destroyAllWindows()breakfinally:# Stop streamingpipeline.stop()

參考:(53條消息) python 調用 Intel realsense D415攝像頭_weixin_44576543的博客-CSDN博客_python realsense?

總結

以上是生活随笔為你收集整理的python 调用 Intel realsense D415i摄像头的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。