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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

D455 如何同时传输视频深度流和惯性单元IMU流?(双管道方法与调用回调方法)

發布時間:2025/3/20 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 D455 如何同时传输视频深度流和惯性单元IMU流?(双管道方法与调用回调方法) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文章目錄

    • 雙管道方法
    • 回調callback方法

【D455】【python】How to get color_stream\depth_steam\accel_stream\gyro_stream at the same time?

MartyG-RealSense commented yesterday ?
Hi @Dontla When streaming depth, color and IMU at the same time, there is sometimes a problem where the RGB stream becomes No Frames Received or more rarely, the IMU frames stop being received. To deal with this issue, the recommended solutions are to either use two separate pipelines (IMU alone on one pipeline and depth / color on the other pipeline), or to use callbacks.

For the separate pipeline approach, I recommend the Python script in the link below…

#5628 (comment)

For the callback approach in Python, the link below is a good reference.

#5417

雙管道方法

# -*- coding: utf-8 -*- """ @File : D455_double_pipeline.py @Time : 2020/12/19 16:07 @Author : Dontla @Email : sxana@qq.com @Software: PyCharm """ ## License: Apache 2.0. See LICENSE file in root directory. ## Parts of this code are ## Copyright(c) 2015-2017 Intel Corporation. All Rights Reserved.################################################## ## configurable realsense viewer ## ##################################################import pyrealsense2 as rs import numpy as np import cv2 import time# # NOTE: it appears that imu, rgb and depth cannot all be running simultaneously. # Any two of those 3 are fine, but not all three: causes timeout on wait_for_frames() # device_id = None # "923322071108" # serial number of device to use or None to use default enable_imu = True enable_rgb = True enable_depth = True # TODO: enable_pose # TODO: enable_ir_stereo# Configure streams if enable_imu:imu_pipeline = rs.pipeline()imu_config = rs.config()if None != device_id:imu_config.enable_device(device_id)imu_config.enable_stream(rs.stream.accel, rs.format.motion_xyz32f, 63) # accelerationimu_config.enable_stream(rs.stream.gyro, rs.format.motion_xyz32f, 200) # gyroscopeimu_profile = imu_pipeline.start(imu_config)if enable_depth or enable_rgb:pipeline = rs.pipeline()config = rs.config()# if we are provided with a specific device, then enable itif None != device_id:config.enable_device(device_id)if enable_depth:config.enable_stream(rs.stream.depth, 848, 480, rs.format.z16, 60) # depthif enable_rgb:config.enable_stream(rs.stream.color, 424, 240, rs.format.bgr8, 60) # rgb# Start streamingprofile = pipeline.start(config)# Getting the depth sensor's depth scale (see rs-align example for explanation)if enable_depth:depth_sensor = profile.get_device().first_depth_sensor()depth_scale = depth_sensor.get_depth_scale()print("Depth Scale is: ", depth_scale)if enable_depth:# Create an align object# rs.align allows us to perform alignment of depth frames to others frames# The "align_to" is the stream type to which we plan to align depth frames.align_to = rs.stream.coloralign = rs.align(align_to)try:frame_count = 0start_time = time.time()frame_time = start_timewhile True:last_time = frame_timeframe_time = time.time() - start_timeframe_count += 1## get the frames#if enable_rgb or enable_depth:frames = pipeline.wait_for_frames(200 if (frame_count > 1) else 10000) # wait 10 seconds for first frameif enable_imu:imu_frames = imu_pipeline.wait_for_frames(200 if (frame_count > 1) else 10000)if enable_rgb or enable_depth:# Align the depth frame to color framealigned_frames = align.process(frames) if enable_depth and enable_rgb else Nonedepth_frame = aligned_frames.get_depth_frame() if aligned_frames is not None else frames.get_depth_frame()color_frame = aligned_frames.get_color_frame() if aligned_frames is not None else frames.get_color_frame()# Convert images to numpy arraysdepth_image = np.asanyarray(depth_frame.get_data()) if enable_depth else Nonecolor_image = np.asanyarray(color_frame.get_data()) if enable_rgb else None# 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) if enable_depth else None# Stack both images horizontallyimages = Noneif enable_rgb:images = np.hstack((color_image, depth_colormap)) if enable_depth else color_imageelif enable_depth:images = depth_colormap# Show imagescv2.namedWindow('RealSense', cv2.WINDOW_AUTOSIZE)if images is not None:cv2.imshow('RealSense', images)if enable_imu:accel_frame = imu_frames.first_or_default(rs.stream.accel, rs.format.motion_xyz32f)gyro_frame = imu_frames.first_or_default(rs.stream.gyro, rs.format.motion_xyz32f)print("imu frame {} in {} seconds: \n\taccel = {}, \n\tgyro = {}".format(str(frame_count),str(frame_time - last_time), str(accel_frame.as_motion_frame().get_motion_data()), str(gyro_frame.as_motion_frame().get_motion_data())))# Press esc or 'q' to close the image windowkey = cv2.waitKey(1)if key & 0xFF == ord('q') or key == 27:cv2.destroyAllWindows()breakfinally:# Stop streamingpipeline.stop()

不錯的,能正常運行

回調callback方法

代碼運行不成功,還沒解決咋弄

# -*- coding: utf-8 -*- """ @File : D455_callback.py @Time : 2020/12/25 11:30 @Author : Dontla @Email : sxana@qq.com @Software: PyCharm """ import pyrealsense2 as rspipeline = rs.pipeline()def test_callback(fs):global framesetframeset = fspipeline.stop()profile = pipeline.start(test_callback) # print(profile) # <pyrealsense2.pyrealsense2.pipeline_profile object at 0x000001FF99DE3490>profile.get_streams() # print(stream) # [<pyrealsense2.video_stream_profile: 1(0) 848x480 @ 30fps 1>, <pyrealsense2.video_stream_profile: 2(0) 1280x720 @ 30fps 5>, <pyrealsense2.stream_profile: 5(0) @ 200fps 16>, <pyrealsense2.stream_profile: 6(0) @ 63fps 16>]frameset D:\20191031_tensorflow_yolov3\python\python.exe C:/Users/Administrator/Desktop/test_D455/D455_callback.py Traceback (most recent call last):File "C:/Users/Administrator/Desktop/test_D455/D455_callback.py", line 28, in <module>frameset NameError: name 'frameset' is not definedProcess finished with exit code 1

總結

以上是生活随笔為你收集整理的D455 如何同时传输视频深度流和惯性单元IMU流?(双管道方法与调用回调方法)的全部內容,希望文章能夠幫你解決所遇到的問題。

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

主站蜘蛛池模板: 久久动态图 | 看91| 深夜福利在线播放 | 成人午夜免费毛片 | 国产人人爽| 亚洲高清天堂 | 精品福利一区二区 | 免费黄色在线网站 | 欧美一区二区激情 | 天堂网站 | 欧美韩国一区 | 成年人激情视频 | 欧美一区二区三区 | 99re免费视频 | 特黄视频 | 伊人影院99 | 三级小视频在线观看 | 日韩小视频在线观看 | 天天爽天天爽 | 人妻洗澡被强公日日澡电影 | 日本一区二区三区欧美 | 吊侵犯の奶水授乳羞羞漫画 | av官网在线观看 | 男生脱女生衣服 | 日韩高清影院 | 免费成人国产 | 久久怡红院 | 毛片黄色一级 | 美女脱裤子让男人捅 | 精品国产乱码久久久久久郑州公司 | 亚洲视频在线免费 | 色综合天天综合网天天看片 | 国产乱妇4p交换乱免费视频 | 99资源站| 天天干天天干天天操 | 日韩亚洲在线 | 国产婷婷一区二区 | 国产精品va无码一区二区三区 | 亚洲免费观看 | 日本人做爰全过程 | 国产亚洲无| 激情视频网 | 中文字幕有码视频 | 亚洲最大免费视频 | 成人中文视频 | 欧美在线一级视频 | 欧美色图在线播放 | 久久久噜噜噜www成人 | 日本国产在线视频 | 久久成人久久爱 | feel性丰满白嫩嫩hd | 日本精品999| 葵司ssni-879在线播放 | 国产精品 欧美激情 | 亚洲第一天堂 | 岛国伊人 | 91日本在线观看 | 91在线播放视频 | 日日夜夜天天操 | 国产av一区二区三区精品 | 伊人免费在线观看高清版 | 亚洲毛片在线观看 | 干爹你真棒插曲mv在线观看 | 131美女爱做视频 | www,av在线| xx99小雪 | 成人a区| 日韩中文字幕免费观看 | 男女啪啪av | 欧美激情va永久在线播放 | 国产va在线 | 91在线观看成人 | 久久午夜场 | 国产剧情一区在线 | 免费大片av| 欧美第一网站 | 亚洲国产黄色av | 日本色视频 | 久久久精品欧美 | 欧美日韩一区二区视频在线观看 | 奇米狠狠干 | 日韩成人欧美 | 久久99久久99精品免视看婷婷 | 亚洲午夜福利一区二区三区 | 亚洲视频一区在线播放 | 欧美亚洲韩国 | 久久国产露脸精品国产 | 一区二区三区在线播放 | 免费三片在线视频 | 91蝌蚪91九色白浆 | 欧美成人精品一区二区三区在线看 | 免费在线观看成年人视频 | 国产精品偷拍 | 丁香婷婷网 | 麻豆av网址| 青青青青青青青青草 | 一区二区精品久久 | 久久久久久国产精品三级玉女聊斋 | 摸大乳喷奶水www视频 |