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

歡迎訪問 生活随笔!

生活随笔

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

python

PCL:python pcl解码RGB- point_cloud2.read_points rgb

發布時間:2023/12/31 python 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 PCL:python pcl解码RGB- point_cloud2.read_points rgb 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

參考:https://answers.ros.org/question/344096/subscribe-pointcloud-and-convert-it-to-numpy-in-python/

rgb在C++中的解碼方式為:???

unsigned long rgb = *reinterpret_cast<int*>(&cloud->points[i].rgb); int r = (rgb >> 16) & 0x0000ff; int g = (rgb >> 8) & 0x0000ff; int b = (rgb) & 0x0000ff;

當然可以直接使用 data.r 方式獲取,編碼簡單,速度稍慢一些。

python代碼段:

test = x[3] # cast float32 to int so that bitwise operations are possibles = struct.pack('>f' ,test)i = struct.unpack('>l',s)[0]# you can get back the float value by the inverse operationspack = ctypes.c_uint32(i).valuer = (pack & 0x00FF0000)>> 16g = (pack & 0x0000FF00)>> 8b = (pack & 0x000000FF)# prints r,g,b values in the 0-255 range# x,y,z can be retrieved from the x[0],x[1],x[2]xyz = np.append(xyz,[[x[0],x[1],x[2]]], axis = 0)rgb = np.append(rgb,[[r,g,b]], axis = 0)

可以解析出rgb

?

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的PCL:python pcl解码RGB- point_cloud2.read_points rgb的全部內容,希望文章能夠幫你解決所遇到的問題。

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