点云技术相关产学研社区

 找回密码
 立即注册加入PCL中国点云技术相关产学研社区

扫一扫,访问微社区

查看: 3554|回复: 0

分享一个对点云进行椭圆或者圆拟合的开源代码

[复制链接]
发表于 2017-10-23 21:40:58 | 显示全部楼层 |阅读模式
本帖最后由 王三国 于 2017-10-26 23:00 编辑

开源代码网址是https://www.codeproject.com/Arti ... -circle-and-ellipse


示例程序
#include <iostream>
#include <sstream>
#include "BestFit.h"


int main(int argc, char * argv[])
{
    int count = 10;
    double points[20] = {
        99.9510022,201.01559,
        100.0701559,199.016258,
        100.921381,200.0685969,
        99.031849,199.895546,
        99.469357,200.869111,
        100.525856,200.793908,
        99.13055,200.56031,
        100.787632,199.483885,
        100.498142,199.169206,
        99.363449,199.276086
    };


    // Input settings specify the source coordinates.
    BestFitIO input;
    input.numPoints = count;
    input.points = points;


    // Output settings in this simple example left with default values.
    BestFitIO output;


    // Create the best-fitting circle object, and make it do the work.
    int type = BestFitFactory::Circle;
    BestFit *b = BestFitFactory::Create(type, std::cout);
    b->Compute(input, output);


    ... // output contains solved parameters, and optionally the adjusted points.


    // The factory allocated memory needs to be freed.  
    delete b;
    return 0;
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册加入PCL中国点云技术相关产学研社区

x
回复

使用道具 举报

本版积分规则

QQ|小黑屋|点云技术相关产学研社区 ( 陕ICP备13001629号 )

GMT+8, 2024-4-25 20:01 , Processed in 1.686385 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表