国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

[python][pcl]python-pcl案例之為平面模型構(gòu)造凹凸外殼多邊形

這篇具有很好參考價(jià)值的文章主要介紹了[python][pcl]python-pcl案例之為平面模型構(gòu)造凹凸外殼多邊形。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

測(cè)試環(huán)境:

pcl==1.12.1

python-pcl==0.3.1

python==3.7

代碼:

# -*- coding: utf-8 -*-
# Construct a concave or convex hull polygon for a plane model
# http://pointclouds.org/documentation/tutorials/hull_2d.php#hull-2d

import numpy as np
import pcl
import random


def main():
    #  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>),
    #                                      cloud_filtered (new pcl::PointCloud<pcl::PointXYZ>),
    #                                      cloud_projected (new pcl::PointCloud<pcl::PointXYZ>);
    # cloud = pcl.PointCloud()
    # cloud_filtered = pcl.PointCloud()
    # cloud_projected = pcl.PointCloud()

    #  pcl::PCDReader reader;
    #  reader.read ("table_scene_mug_stereo_textured.pcd", *cloud);
    cloud = pcl.load(
        r"C:\Users\Administrator\Desktop\python-pcl\examples\pcldata\tutorials\table_scene_mug_stereo_textured.pcd")

    # // Build a filter to remove spurious NaNs
    # pcl::PassThrough<pcl::PointXYZ> pass;
    # pass.setInputCloud (cloud);
    # pass.setFilterFieldName ("z");
    # pass.setFilterLimits (0, 1.1);
    # pass.filter (*cloud_filtered);
    # std::cerr << "PointCloud after filtering has: "
    #           << cloud_filtered->points.size () << " data points." << std::endl;
    passthrough = cloud.make_passthrough_filter()
    passthrough.set_filter_field_name("z")
    passthrough.set_filter_limits(0.0, 1.1)
    cloud_filtered = passthrough.filter()
    print('PointCloud after filtering has: ' +
          str(cloud_filtered.size) + ' data points.')

    # pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients);
    # pcl::PointIndices::Ptr inliers (new pcl::PointIndices);
    # // Create the segmentation object
    # pcl::SACSegmentation<pcl::PointXYZ> seg;
    # // Optional
    # seg.setOptimizeCoefficients (true);
    # // Mandatory
    # seg.setModelType (pcl::SACMODEL_PLANE);
    # seg.setMethodType (pcl::SAC_RANSAC);
    # seg.setDistanceThreshold (0.01);
    # seg.setInputCloud (cloud_filtered);
    # seg.segment (*inliers, *coefficients);
    # std::cerr << "PointCloud after segmentation has: "
    #           << inliers->indices.size () << " inliers." << std::endl;
    seg = cloud_filtered.make_segmenter_normals(ksearch=50)
    seg.set_optimize_coefficients(True)
    seg.set_model_type(pcl.SACMODEL_NORMAL_PLANE)
    seg.set_method_type(pcl.SAC_RANSAC)
    seg.set_distance_threshold(0.01)
    indices, model = seg.segment()

    print('PointCloud after segmentation has: ' +
          str(indices.count) + ' inliers.')

    #   // Project the model inliers
    #   pcl::ProjectInliers<pcl::PointXYZ> proj;
    #   proj.setModelType (pcl::SACMODEL_PLANE);
    #   proj.setIndices (inliers);
    #   proj.setInputCloud (cloud_filtered);
    #   proj.setModelCoefficients (coefficients);
    #   proj.filter (*cloud_projected);
    #   std::cerr << "PointCloud after projection has: "
    #             << cloud_projected->points.size () << " data points." << std::endl;
    proj = cloud_filtered.make_ProjectInliers()
    proj.set_model_type(pcl.SACMODEL_PLANE)
    #   proj.setIndices (inliers);
    #   proj.setModelCoefficients (coefficients)
    cloud_projected = proj.filter()

    print('PointCloud after projection has: ' +
          str(cloud_projected.size) + ' data points.')

    #   // Create a Concave Hull representation of the projected inliers
    #   pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_hull (new pcl::PointCloud<pcl::PointXYZ>);
    #   pcl::ConcaveHull<pcl::PointXYZ> chull;
    #   chull.setInputCloud (cloud_projected);
    #   chull.setAlpha (0.1);
    #   chull.reconstruct (*cloud_hull);
    #   std::cerr << "Concave hull has: " << cloud_hull->points.size ()
    #             << " data points." << std::endl;
    # cloud_projected = pcl.PointCloud()
    chull = cloud_projected.make_ConcaveHull()
    chull.set_Alpha(0.1)
    cloud_hull = chull.reconstruct()
    print('Concave hull has: ' + str(cloud_hull.size) + ' data points.')

    #   pcl::PCDWriter writer;
    #   writer.write ("table_scene_mug_stereo_textured_hull.pcd", *cloud_hull, false);

    if cloud_hull.size != 0:
        pcl.save(cloud_hull, 'table_scene_mug_stereo_textured_hull.pcd')


if __name__ == "__main__":
    # import cProfile
    # cProfile.run('main()', sort='time')
    main()

運(yùn)行結(jié)果:

PointCloud after filtering has: 139656 data points.
PointCloud after segmentation has: <built-in method count of list object at 0x0000028CA3429A48> inliers.
PointCloud after projection has: 139656 data points.
Concave hull has: 281 data points.

table_scene_mug_stereo_textured.pcd文件需要去這個(gè)地址下載:

https://github.com/strawlab/python-pcl/blob/master/examples/pcldata/tutorials/table_scene_mug_stereo_textured.pcd文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-514970.html

到了這里,關(guān)于[python][pcl]python-pcl案例之為平面模型構(gòu)造凹凸外殼多邊形的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 【點(diǎn)云】生成有凹凸的平面

    【點(diǎn)云】生成有凹凸的平面

    嘗試用一些數(shù)據(jù)生成有凹凸面的點(diǎn)云。 我們姑且把z軸當(dāng)成有凹凸的缺陷,x軸和y軸共同組成一個(gè)平面。 高斯函數(shù)wiki中,我們得知 其中,σ為標(biāo)準(zhǔn)差,用來(lái)控制“鐘形”的寬度。 根據(jù)wiki中下面的舉例 sigma_X = 1;sigma_Y = 2; 可以看出,σx=σy時(shí),高斯的水平集是個(gè)圓,σx不等于σ

    2024年02月19日
    瀏覽(19)
  • OpenGL ES入門教程(三)之為平面桌子添加混合色

    OpenGL ES入門教程(三)之為平面桌子添加混合色

    上一篇文章我們講解了OpenGL ES如何繪制一個(gè)平面桌子,本文在其基礎(chǔ)上繼續(xù)講解如何使繪制的平面桌子具有混合色,效果類似在桌子中心上面吊一盞燈,越靠近桌子中心顏色越亮白,越遠(yuǎn)離桌子中心顏色越暗灰。如果是OpenGL ES小白,在閱讀本篇文章之前一定要搞懂上篇文章

    2024年02月05日
    瀏覽(24)
  • 3D點(diǎn)云處理:圓柱側(cè)面點(diǎn)云展開為平面 凹凸缺陷檢測(cè)(附源碼)

    訂閱說(shuō)明:如果要訂閱,先看鏈接內(nèi)容 看鏈接內(nèi)容 看鏈接內(nèi)容:訂閱先看此內(nèi)容 文章目錄: 3D視覺(jué)個(gè)人學(xué)習(xí)目錄 目標(biāo):對(duì)采集的圓柱面點(diǎn)云展開為平面; 應(yīng)用:可用于檢測(cè)圓柱側(cè)面的凹凸缺陷; ????? 圓柱的側(cè)面展開原理是將一個(gè)圓柱體(或柱體)的側(cè)面展開成一個(gè)矩

    2024年02月09日
    瀏覽(133)
  • Matlab 最小二乘法 擬合平面 (PCL PCA擬合平面)

    Matlab 最小二乘法 擬合平面 (PCL PCA擬合平面)

    最小二乘法 擬合平面是我們最常用的擬合平面的方法,但是有特殊的情況是用這種方法是不能擬合的,后續(xù)會(huì)加上這種擬合方法(RANSAC)。 matlab 最小二乘擬合平面(方法一) - 灰信網(wǎng)(軟件開發(fā)博客聚合) 平面方程:Ax+By+Cz+D=0; ? 1、隨機(jī)出來(lái)一些離散的點(diǎn) ?? 2、將其寫成

    2024年02月16日
    瀏覽(24)
  • PCL RANSAC擬合平面(C++詳細(xì)過(guò)程版)

    PCL RANSAC擬合平面(C++詳細(xì)過(guò)程版)

    本文由CSDN點(diǎn)云俠原創(chuàng),原文鏈接。如果你不是在點(diǎn)云俠的博客中看到該文章,那么此處便是不要臉的爬蟲。 ??RANSAC擬合平面,采用的是不共線的三個(gè)點(diǎn)確定一個(gè)平面,據(jù)以實(shí)現(xiàn)原理見(jiàn):PCL 三點(diǎn)確定一個(gè)平面原理及代碼

    2024年02月13日
    瀏覽(22)
  • PCL 點(diǎn)云投影到平面(C++詳細(xì)過(guò)程版)

    ??點(diǎn)云投影到平面在PCL里有現(xiàn)成的調(diào)用函數(shù),具體算法原理和實(shí)現(xiàn)代碼見(jiàn):PCL 點(diǎn)云投影到擬合平面。為充分了解點(diǎn)云投影到平面實(shí)現(xiàn)的每一個(gè)細(xì)節(jié)和有待改進(jìn)的地方,使用C++代碼對(duì)算法實(shí)現(xiàn)過(guò)程進(jìn)行復(fù)現(xiàn)。

    2024年02月02日
    瀏覽(19)
  • PCL 計(jì)算一個(gè)平面與一個(gè)三角形的交線

    這里實(shí)現(xiàn)一個(gè)很有趣的功能,就是獲取一個(gè)平面與一個(gè)三角形的交線,具體的思路很簡(jiǎn)單,就是借助之前的博客中的思路:Matlab 計(jì)算一個(gè)平面與一條線段的交點(diǎn),我們只需要遍歷三角形中的所有邊即可獲取我們想要的交線,這里是PCL版本。

    2024年02月06日
    瀏覽(27)
  • PCL 建筑物點(diǎn)云立面和平面分割提取

    ??在建筑物點(diǎn)云中,立面點(diǎn)和平面點(diǎn)的法向量存在明顯的差異,根據(jù)法向量在Z方向的分量設(shè)置相應(yīng)得閾值即可實(shí)現(xiàn)立面點(diǎn)與平面點(diǎn)的分割。

    2024年02月06日
    瀏覽(22)
  • pcl matlab 計(jì)算平面與空間三角形的交線

    pcl matlab 計(jì)算平面與空間三角形的交線

    ?過(guò)程: 單有法向量不能確定一個(gè)平面,至少還要有平面上的一個(gè)點(diǎn)的坐標(biāo)才行 假如知道法向量n=(A,B,C) 而平面過(guò)某點(diǎn)M=(x0,y0,z0) 那么平面的方程為 A(x-x0)+B(y-y0)+C(z-z0)=0 要在圖中畫出來(lái),那么先要給x,y一個(gè)范圍 舉個(gè)離子,平面法向量(1,1,1)過(guò)點(diǎn)(0,1,2) 畫出x,y在 -2~2區(qū)

    2024年02月12日
    瀏覽(22)
  • 大數(shù)據(jù)分析案例-基于XGBoost算法構(gòu)造房屋租賃價(jià)格評(píng)估模型

    大數(shù)據(jù)分析案例-基于XGBoost算法構(gòu)造房屋租賃價(jià)格評(píng)估模型

    ???♂? 個(gè)人主頁(yè):@艾派森的個(gè)人主頁(yè) ???作者簡(jiǎn)介:Python學(xué)習(xí)者 ?? 希望大家多多支持,我們一起進(jìn)步!?? 如果文章對(duì)你有幫助的話, 歡迎評(píng)論 ??點(diǎn)贊???? 收藏 ??加關(guān)注+ 喜歡大數(shù)據(jù)分析項(xiàng)目的小伙伴,希望可以多多支持該系列的其他文章 大數(shù)據(jù)分析案例合集

    2023年04月19日
    瀏覽(25)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包