当前位置: 首页> 专利交易> 详情页
    待售中

    一种点云数据的线性拟合方法和装置[ZH]

    专利编号: ZL202609180123

    收藏

    拟转化方式: 转让;普通许可;独占许可;排他许可;开放许可

    交易价格:面议

    专利类型:发明专利

    法律状态:授权

    技术领域:非汽车专利

    发布日期:2026-09-18

    发布有效期: 2026-09-18 至 2042-09-20

    专利顾问 — 王老师

    电话咨询

    咨询电话

    13760886304

    专利基本信息
    >
    申请号 CN202211142363.X 公开号 CN115222897A
    申请日 2022-09-20 公开日 2022-10-21
    申请人 中汽创智科技有限公司 专利授权日期 2024-07-12
    发明人 蔡香玉;周勋;胡帅朋;龚小鹏;李建昆;张灿;胡伟 专利权期限届满日 2042-09-20
    申请人地址 211100 江苏省南京市江宁区秣陵街道胜利路88号 最新法律状态 授权
    技术领域 非汽车专利 分类号 G06T17/00
    技术效果 其他技术效果 有效性 有效(授权、部分无效)
    专利代理机构 广州三环专利商标代理有限公司 44202 代理人 郑华洁
    专利技术详情
    >
    01

    专利摘要

    本发明涉及了一种点云数据的线性拟合方法和装置,该方法包括:获取待进行衔接的第一线段点簇的终点数据和第二线段点簇的起点数据,得到第一点数据和第二点数据;分别获取第一线段点簇在第一点数据处的方向向量、第二线段点簇在第二点数据处的方向向量、第一点数据和第二点数据构成的目标向量的方向向量;确定第一线段点簇和第二线段点簇之间的衔接线段的曲直性;若衔接线段为曲线,则利用参数化的曲线拟合模型对衔接线段进行拟合,并利用第一方向向量和第二方向向量作为拟合的约束条件,得到第一目标衔接线段。本方案在曲线拟合时增加方向约束条件,使得在连续的线性连接时能够达到平滑连接的效果。
    展开 >
    02

    专利详情

    技术领域

    本发明涉及点云数据处理技术领域,尤其涉及一种点云数据的线性拟合方法和装置。

    背景技术

    三维点云数据是用三维坐标(x,y,z)数据表征的许多点的集合。点云数据能够表征物体的表面三维信息,但是这些散点表达方式的拓扑属性较差,且冗余数据较多。线特征是表达物体表面几何结构的重要方式,将散点拟合成直线和曲线,可以降低点云数据的冗余,真实准确地表征物体表面的几何结构。

    对于点数量较多或线性特征较为复杂的点云数据,为了提高线性拟合的准确性,会对点云数据先进行分段,然后对各个子段分别进行拟合,得到多个线段点簇。为了综合表达物体表面的几何结构,还需要将多个线段点簇进一步衔接起来。

    目前,基于散点的线性拟合主要是先忽略散点的z坐标,只对散点的(x,y)坐标做直线或曲线的拟合。这种方法应用于上述线段点簇衔接的场景中,拟合得到的衔接线段往往不够平滑,有可能与前后两个线段点簇衔接不上,这样使得拟合线段不能准确的表达物体表面的几何结构。

    发明内容

    本发明旨在至少解决现有技术中存在的技术问题之一。为此,本发明第一方面提出一种点云数据的线性拟合方法,所述方法包括:

    一种点云数据的线性拟合方法,其特征在于,所述方法包括:

    获取待进行衔接的第一线段点簇的终点数据和第二线段点簇的起点数据,得到第一点数据和第二点数据;

    分别获取所述第一线段点簇在所述第一点数据处的方向向量、所述第二线段点簇在所述第二点数据处的方向向量、所述第一点数据和所述第二点数据构成的目标向量的方向向量,得到第一方向向量、第二方向向量和第三方向向量;

    根据所述第一方向向量、所述第二方向向量、所述第三方向向量,确定所述第一线段点簇和所述第二线段点簇之间的衔接线段的曲直性;

    若所述衔接线段为曲线,则利用参数化的曲线拟合模型对所述衔接线段进行拟合,并利用所述第一方向向量和所述第二方向向量作为拟合的约束条件,得到第一目标衔接线段;

    利用所述第一目标衔接线段连接所述第一线段点簇和所述第二线段点簇。

    本发明第二方面提出一种点云数据的线性拟合装置,所述装置包括:

    点数据获取模块,用于获取待进行衔接的第一线段点簇的终点数据和第二线段点簇的起点数据,得到第一点数据和第二点数据;

    方向向量获取模块,用于分别获取所述第一线段点簇在所述第一点数据处的方向向量、所述第二线段点簇在所述第二点数据处的方向向量、所述第一点数据和所述第二点数据构成的目标向量的方向向量,得到第一方向向量、第二方向向量和第三方向向量;

    曲直性确定模块,用于根据所述第一方向向量、所述第二方向向量、所述第三方向向量,确定所述第一线段点簇和所述第二线段点簇之间的衔接线段的曲直性;

    曲线拟合模块,用于若所述衔接线段为曲线,则利用参数化的曲线拟合模型对所述衔接线段进行拟合,并利用所述第一方向向量和所述第二方向向量作为拟合的约束条件,得到第一目标衔接线段;

    连接模块,用于利用所述第一目标衔接线段连接所述第一线段点簇和所述第二线段点簇。

    本发明第三方面提出一种电子设备,所述电子设备包括处理器和存储器,所述存储器种存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由所述处理器加载并执行以实现如第一方面所述的点云数据的线性拟合方法。

    本发明第四方面提出一种计算机可读存储介质,所述存储介质中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由处理器加载并执行以实现如第一方面所述的点云数据的线性拟合方法。

    本发明实施例具有以下有益效果:

    在本发明实施例中,获取待进行衔接的第一线段点簇的终点数据和第二线段点簇的起点数据,得到第一点数据和第二点数据;分别获取第一线段点簇在第一点数据处的方向向量、第二线段点簇在第二点数据处的方向向量、第一点数据和第二点数据构成的目标向量的方向向量,得到第一方向向量、第二方向向量和第三方向向量;根据第一方向向量、第二方向向量、第三方向向量,确定第一线段点簇和第二线段点簇之间的衔接线段的曲直性;若衔接线段为曲线,则利用参数化的曲线拟合模型对衔接线段进行拟合,并利用第一方向向量和第二方向向量作为拟合的约束条件,得到第一目标衔接线段;利用第一目标衔接线段连接第一线段点簇和第二线段点簇。本方案通过对衔接线段曲直性的判断,增强了对线性场景的适应性;并且,本方案在曲线拟合时增加方向约束条件,使得在连续的线性连接时能够达到平滑连接的效果,使得拟合线段能够准确的表达物体表面的几何结构。

    本发明的附加方面和优点将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本发明的实践了解到。

    附图说明

    为了更清楚地说明本发明的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单的介绍。显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还能够根据这些附图获得其它附图。

    图1为本发明实施例提供的第一种点云数据的线性拟合方法的步骤流程图;

    图2为本发明实施例提供的第一线段点簇和第二线段点簇的示意图;

    图3为本发明实施例提供的第二种点云数据的线性拟合方法的步骤流程图;

    图4(a)为本发明实施例提供的一种端点方向向量长度对曲线拟合影响的示意图一;

    图4(b)为本发明实施例提供的一种端点方向向量长度对曲线拟合影响的示意图二;

    图5为本发明实施例提供的第三种点云数据的线性拟合方法的步骤流程图;

    图6为本发明实施例提供的一种点云数据的线性拟合装置的结构框图。

    具体实施方式

    下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。

    本说明书提供了如实施例或流程图所述的方法操作步骤,但基于常规或无创造性的劳动可以包括更多或者更少的操作步骤。在实际中的系统或服务器产品执行时,可以按照实施例或者附图所示的方法顺序执行或者并行执行(例如并行处理器或者多线程处理的环境)。

    图1为本发明实施例提供的第一种点云数据的线性拟合方法的步骤流程图。该方法可以包括如下步骤:

    步骤101、获取待进行衔接的第一线段点簇的终点数据和第二线段点簇的起点数据,得到第一点数据和第二点数据。

    对于点数量较多或线性特征较为复杂的点云数据,为了提高线性拟合的准确性,会对点云数据先进行分段,然后对各个子段分别进行拟合,得到多个线段点簇。为了综合表达物体表面的几何结构,还需要将多个线段点簇进一步衔接起来。

    第一线段点簇和第二线段点簇为原始点云数据被分成的多个子段中的两个子段,当前需要将第一线段点簇和第二线段点簇利用线性拟合的方法平滑的衔接起来。

    第一线段点簇的位置在第二线段点簇的前面。获取位于第一线段点簇的末尾的那个点数据的坐标,即终点数据,获取位于第二线段点簇的起点的那个点数据的坐标,即起点数据。将终点数据作为第一点数据,将起点数据作为第二点数据。

    图2为本发明实施例提供的第一线段点簇和第二线段点簇的示意图。

    如图2所示,L1为第一线段点簇,L2为第二线段点簇。三维点P1(x1,y1,z1)、P2(x2,y2,z2)分别对应平面点A(x1,y1),B(x2,y2)。其中,点A为L1的终点,点B为L2的起点,即点A(x1,y1)为第一点数据,点B(x2,y2)为第二点数据。

    步骤102、分别获取所述第一线段点簇在所述第一点数据处的方向向量、所述第二线段点簇在所述第二点数据处的方向向量、所述第一点数据和所述第二点数据构成的目标向量的方向向量,得到第一方向向量、第二方向向量和第三方向向量。

    空间直线的方向用一个与该直线平行的非零向量来表示,该向量称为这条直线的一个方向向量。直线在空间中的位置,由它经过的空间一点及它的一个方向向量完全确定。

    此处还需要验证第一点数据和第二点数据是否为同一个点,且第一点数据和第二点数据是否都具有有效的方向向量。如果第一点数据和第二点数据是同一个点,或者,第一点数据或第二点数据没有有效的方向向量,则均退出本方案流程。

    在确定上述两种情况均不存在后,获取第一方向向量、第二方向向量和第三方向向量。

    参照图2,L1在点A处的方向向量为,L2在点B处的方向向量为,点A和点B构成的向量的方向向量为

    其中,x5,y5的计算方法如下:

    (1)

    (2)

    这样,得到第一方向向量,第二方向向量,第三方向向量

    步骤103、根据所述第一方向向量、所述第二方向向量、所述第三方向向量,确定所述第一线段点簇和所述第二线段点簇之间的衔接线段的曲直性。

    具体地,若第一方向向量、第二方向向量、第三方向向量的方向一致,则第一线段点簇和所述第二线段点簇之间的衔接线段为直线,若第一方向向量、第二方向向量、第三方向向量的方向不一致,则连接线段为曲线。

    步骤104、若所述衔接线段为曲线,则利用参数化的曲线拟合模型对所述衔接线段进行拟合,并利用所述第一方向向量和所述第二方向向量作为拟合的约束条件,得到第一目标衔接线段。

    若衔接线段为曲线,则需要利用曲线拟合模型对衔接线段进行拟合。曲线拟合模型包括二次多项式函数、三次多项式函数、半对数函数、Log-Log拟合函数等,可以根据点云数据的线性特征选择最适合的函数作为本方案中的曲线拟合模型。

    为了增强拟合效果、提高衔接线段的平滑度,可以利用第一方向向量和第二方向向量作为拟合的约束条件,使得衔接线段的方向变化与第一方向向量和第二方向向量更为匹配。

    与现有技术中只使用第一点数据和第二点数据的坐标对衔接线段进行拟合相比,本方案中将第一方向向量和第二方向向量也作为拟合的约束条件,使得在连续的线性连接中能够达到平滑连接的效果。

    步骤105、利用所述第一目标衔接线段连接所述第一线段点簇和所述第二线段点簇。

    在拟合得到第一目标衔接线段后,利用第一目标衔接线段连接所述第一线段点簇和所述第二线段点簇,第一线段点簇、第一目标衔接线段和第二线段点簇三者组成一段平滑的线段,能够真实准确地表征物体表面的几何结构。

    综上,在本发明实施例中,获取待进行衔接的第一线段点簇的终点数据和第二线段点簇的起点数据,得到第一点数据和第二点数据;分别获取第一线段点簇在第一点数据处的方向向量、第二线段点簇在第二点数据处的方向向量、第一点数据和第二点数据构成的目标向量的方向向量,得到第一方向向量、第二方向向量和第三方向向量;根据第一方向向量、第二方向向量、第三方向向量,确定第一线段点簇和第二线段点簇之间的衔接线段的曲直性;若衔接线段为曲线,则利用参数化的曲线拟合模型对衔接线段进行拟合,并利用第一方向向量和第二方向向量作为拟合的约束条件,得到第一目标衔接线段;利用第一目标衔接线段连接第一线段点簇和第二线段点簇。本方案通过对衔接线段曲直性的判断,增强了本方案对线性场景的适应性;并且,本方案在曲线拟合时增加方向约束条件,使得在连续的线性连接时能够达到平滑连接的效果,使得拟合线段能够准确的表达物体表面的几何结构。

    图3为本发明实施例提供的第二种点云数据的线性拟合方法的步骤流程图。该方法可以包括如下步骤:

    步骤201、获取待进行衔接的第一线段点簇的终点数据和第二线段点簇的起点数据,得到第一点数据和第二点数据。

    在本发明实施例中,步骤201可以参照步骤101,此处不再赘述。

    步骤202、分别获取所述第一点数据、所述第二点数据、所述第一点数据和所述第二点数据的连线的方向向量,得到第一方向向量、第二方向向量和第三方向向量;所述第一方向向量、所述第二方向向量、所述第三方向向量均为单位向量。

    在本发明实施例中,单位向量是指模等于1的向量。由于是非零向量,单位向量具有确定的方向。

    第一方向向量、所述第二方向向量、所述第三方向向量均为单位向量,可以方便后续确定三个方向向量是否在同一条直线上。

    步骤203、若所述第一方向向量、所述第二方向向量、所述第三方向向量中有任意两个向量不相等,则确定所述衔接线段为曲线。

    由于第一方向向量、所述第二方向向量、所述第三方向向量均为单位向量,所有只需要判断三者是否相等,即可确定三者是否在同一条直线上,由此可以确定衔接线段为曲线还是直线。

    若三者中有任意两个向量不相等,则说明三者不在一条直线上,则说明衔接线段是曲线。

    如图2中示例,点A处的第一方向向量为,点B处的第二方向向量为,向量对应的第三方向向量为,V1≠V2≠V3,则说明衔接线段L3为曲线。

    步骤204、若所述衔接线段为曲线,将参数化的三次多项式确定为曲线拟合模型,所述曲线拟合模型的自变量为所述第一点数据和所述衔接线段上的任意一点之间的距离,所述曲线拟合模型包括八个拟合参数。

    在本发明实施例中,参数化的三次多项式可以表示为:

    (3)

    其中,A1、B1、C1、D1、A2、B2、C2、D2为八个拟合参数。自变量t为第一点数据和衔接线段上的任意一点之间的距离。,其中,,即T为第一点数据和第二点数据之间的距离。在第一点数据处,t=0,在第二点数据处,t=T。

    采用参数化的三次多项式作为曲线拟合模型,足够进行两点之间的拟合,且可以解决一个x坐标对应多个y坐标的问题。

    在步骤204之后,可以选择执行步骤205-步骤208,也可以选择执行步骤209-步骤213。

    步骤205、确定在所述第一点数据处,所述曲线拟合模型对应的第一表达式,在所述第二点数据处,所述曲线拟合模型对应的第二表达式。

    基于图2所示的场景,根据步骤204选取的曲线拟合模型,点A、B之间需要参数化的三次多项式模型进行平滑拟合,因此拟合曲线必须经过点A(x1,y1)和B(x2,y2),并且在点A、B处的前进方向分别为

    具体地,将第一点数据的坐标代入曲线拟合模型,得到第一表达式,将第二点数据的坐标代入曲线拟合模型,得到第二表达式。

    将第一点数据A(x1,y1)、t=0代入曲线拟合模型,得到第一表达式:

    (4)

    将第二点数据B(x2,y2)、t=T代入曲线拟合模型,得到第二表达式:

    (5)

    步骤206、根据所述第一点数据处所述曲线拟合模型的偏导数为所述第一方向向量,所述第二点数据处所述曲线拟合模型的偏导数为所述第二方向向量,得到第一约束条件和第二约束条件。

    曲线拟合模型在第一点数据处的偏导数为第一方向向量,具体如下:

    (6)

    第二点数据处的曲线拟合模型的偏导数为第二方向向量,具体如下:

    (7)

    上述式(6)和式(7)分别为第一约束条件和第二约束条件。

    步骤207、根据所述第一表达式、所述第二表达式、所述第一约束条件和所述第二约束条件确定所述八个拟合参数的取值。

    将第一表达式、第二表达式、第一约束条件和第二约束条件这几个等式进行联立,可以得到八个拟合参数A1、B1、C1、D1、A2、B2、C2、D2的取值。

    步骤208、根据所述八个拟合参数的取值确定第一目标衔接线段。

    在得到八个拟合参数的取值后,将其代入式(3),可以得到第一目标衔接线段的表达式。

    步骤209、对所述第一方向向量设置第一长度调整参数、对所述第二方向向量设置第二长度调整参数。

    为了增强本方案的曲线拟合模型适应多场景拟合的泛化能力,设置参数调节系数来改变第一点数据处和第二点数据处方向向量的长度。具体地,对第一方向向量设置第一长度调整参数,对所述第二方向向量设置第二长度调整参数

    这样,点A处的方向向量的第一调整向量为,点B处的方向向量的第二调整向量为

    这样,根据第一方向向量为单位向量,得到第一长度调整参数与所述第一点数据的横坐标和纵坐标之间的第一关系式;根据第二方向向量为单位向量,得到第二长度调整参数与所述第二点数据的横坐标和纵坐标之间的第二关系式。

    第一方向向量和第二方向向量为单位向量,则有:

    (8)

    根据式(8),可以得到第一关系式和第二关系式如下:

    (9)

    由第一关系式和第二关系式可以看出,由于长度调节参数的加入,第一方向向量和第二方向向量由常量转换为了变量。

    步骤210、根据所述第一点数据处所述曲线拟合模型的偏导数为所述第一方向向量和所述第一长度调整参数的乘积,得到第三约束条件。

    在第一点数据处,t=0,曲线拟合模型在第一点数据处的偏导数为第一方向向量与第一长度调整参数的乘积,第三约束条件具体如下:

    (10)

    步骤211、根据所述第二点数据处所述曲线拟合模型的偏导数为所述第二方向向量和所述第二长度调整参数的乘积,得到第四约束条件。

    在第二点数据处,t=T,曲线拟合模型在第二点数据处的偏导数为第二方向向量与第二长度调整参数的乘积,第四约束条件具体如下:

    (11)

    步骤212、根据所述第一表达式、所述第二表达式、所述第三约束条件和所述第四约束条件对所述衔接线段进行拟合。

    将第一表达式、第二表达式、第三约束条件和第四约束条件这几个等式进行联立,可以得到八个拟合参数A1、B1、C1、D1、A2、B2、C2、D2的取值。其中:

    (12)

    步骤213、根据所述八个拟合参数的取值确定第一目标衔接线段。

    将这八个取值代入式(5),可得到第一目标衔接线段。

    在一种可能的实施方式中,所述对所述第一方向向量设置第一长度调整参数、对所述第二方向向量设置第二长度调整参数,包括:

    根据期望得到的第一目标衔接线段的曲率半径,设置所述第一方向向量的第一长度调整参数的取值、所述第二方向向量的第二长度调整参数的取值。

    在本发明实施例中,经过多次试验,结果表明第一长度调整参数、第二长度调整参数会对第一衔接线段的曲率产生影响。

    图4(a)为本发明实施例提供的一种端点方向向量长度对曲线拟合影响的示意图一。图4(b) 为本发明实施例提供的一种端点方向向量长度对曲线拟合影响的示意图二。

    如图4(a)和图4(b)所示,当点A处的第一调整向量为V4、点B处的第二调整向量为V2时,第一目标衔接线段为曲线L4;当点A处的第一调整向量为V1、点B处的第二调整向量同样为V2时,第一目标衔接线段为曲线L3,其中,V4和V1方向平行。当V4的长度大于V1的长度时,由图4(a)可看出,曲线L4在端点A处比曲线L3更加凸起;当V4的长度小于V1的长度时,由图4(b)可看出,曲线L3在端点A处比曲线L4更加凸起。由此可知,第一目标衔接线段的曲线的曲率与起始端点对应的第一长度调整参数的长度成正比。通过类似的试验,同样可以得到终止节点对应的第二长度调整参数对第一目标衔接线段的曲线的曲率的影响关系。

    因此,只要根据拟合场景的特征提取解算出合适的第一长度调整参数、第二长度调整参数,就可以生成曲率合适的拟合曲线,因此,带有长度调整参数的线性拟合方法对多场景具有更强的适应性和泛化能力。

    步骤214、利用所述第一目标衔接线段连接所述第一线段点簇和所述第二线段点簇。

    在本发明实施例中,步骤214可以参照步骤105,此处不再赘述。

    综上,在本发明实施例中,在端点坐标和方向约束的两点间线性拟合的场景下,通过两点构成的方向向量与两个端点本身的方向向量的比较来确定两点间是直线还是曲线亦或是异常退出的状态,为后续选择拟合模型提供了参考。

    并且,在曲线拟合模型的基础上,增加了端点坐标和方向向量的约束,使得两点间的曲线拟合连接的更加平滑。

    此外,在曲线拟合模型的基础上,提出了基于端点和方向约束条件下带有长度调整参数的曲线拟合方法,通过增加长度调整参数,增强了本方案对多场景具有更强的适应性和泛化能力。

    图5为本发明实施例提供的第三种点云数据的线性拟合方法的步骤流程图。该方法可以包括如下步骤:

    步骤301、获取待进行衔接的第一线段点簇的终点数据和第二线段点簇的起点数据,得到第一点数据和第二点数据。

    在本发明实施例中,步骤301可以参照步骤101,此处不再赘述。

    步骤302、分别获取所述第一点数据、所述第二点数据、所述第一点数据和所述第二点数据的连线的方向向量,得到第一方向向量、第二方向向量和第三方向向量;所述第一方向向量、所述第二方向向量、所述第三方向向量均为单位向量。

    在本发明实施例中,步骤302可以参照步骤202,此处不再赘述。

    步骤303、若所述第一方向向量、所述第二方向向量、所述第三方向向量均相等,则确定所述衔接线段为直线。

    由于第一方向向量、所述第二方向向量、所述第三方向向量均为单位向量,所有只需要判断三者是否相等,即可确定三者是否在同一条直线上,由此可以确定衔接线段为曲线还是直线。

    若三个方向向量均相等,则说明三个方向向量在一条直线上,则说明衔接线段是直线。

    步骤304、若所述衔接线段为直线,则将包含三个参数的直线方程确定为直线拟合模型。

    当判断起点和终点之间的衔接线段为直线时,选择直线方程作为直线拟合模型,直线拟合模型如下所示:

    (13)

    其中,E、F、G为三个拟合参数。

    步骤305、利用所述直线拟合模型对所述衔接线段进行拟合,得到第二目标衔接线段。

    通过直线拟合模型上的第一点数据和第二点数据的坐标值进行直线拟合,可以得到E、F、G为三个拟合参数的取值,将三个拟合参数的取值代入式(13),得到第二目标衔接线段。

    在一种可能的实施方式中,所述利用所述直线拟合模型对所述衔接线段进行拟合,包括步骤3051-步骤3054:

    步骤3051、确定所述第一点数据和所述第二点数据的横坐标相同时,所述直线拟合模型的第三表达式。

    将第一点数据A(x1,y1)、第二点数据B(x2,y2)代入式(13),得到:

    (14)

    将式(14)中的两个式子相减,得到:

    (15)

    当第一点数据和所述第二点数据的横坐标相同时,,此时由式(15)得到第三表达式如下:

    (16)

    步骤3052、确定所述第一点数据和所述第二点数据的纵坐标相同时,所述直线拟合模型的第四表达式。

    当第一点数据和所述第二点数据的横坐标相同时,,此时由式(15)得到第四表达式如下:

    (17)

    步骤3053、确定所述第一点数据和所述第二点数据的横坐标和纵坐标均不相同时,所述直线拟合模型的第五表达式。

    确定所述第一点数据和所述第二点数据的横坐标和纵坐标均不相同时,,此时由式(15)得到第五表达式如下:

    (18)

    步骤3054、根据所述第三表达式、所述第四表达式和所述第五表达式,对所述衔接线段进行拟合。

    将第三表达式、第四表达式、第五表达式这几个等式进行联立,可以得到三个拟合参数E、F、G的取值。

    将这三个取值代入式(13),可得到第二目标衔接线段。

    综上,在本发明实施例中,利用第一方向向量、第二方向向量、第三方向向量为判断衔接线段是直线还是曲线,判断方法简单准确,方便后续利用不同的拟合方法对衔接线段进行拟合。在判定衔接线段为直线的情况下,利用包括三个拟合参数的直线方程进行拟合,提高了拟合效率和拟合准确性。

    图6为本发明实施例提供的一种点云数据的线性拟合装置的结构框图。该装置400包括:

    点数据获取模块401,用于获取待进行衔接的第一线段点簇的终点数据和第二线段点簇的起点数据,得到第一点数据和第二点数据;

    方向向量获取模块402,用于分别获取所述第一线段点簇在所述第一点数据处的方向向量、所述第二线段点簇在所述第二点数据处的方向向量、所述第一点数据和所述第二点数据构成的目标向量的方向向量,得到第一方向向量、第二方向向量和第三方向向量;

    曲直性确定模块403,用于根据所述第一方向向量、所述第二方向向量、所述第三方向向量,确定所述第一线段点簇和所述第二线段点簇之间的衔接线段的曲直性;

    曲线拟合模块404,用于若所述衔接线段为曲线,则利用参数化的曲线拟合模型对所述衔接线段进行拟合,并利用所述第一方向向量和所述第二方向向量作为拟合的约束条件,得到第一目标衔接线段;

    连接模块405,用于利用所述第一目标衔接线段连接所述第一线段点簇和所述第二线段点簇。

    所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。

    在本发明实施例中,所述第一方向向量、所述第二方向向量、所述第三方向向量均为单位向量。

    在本发明实施例中,所述曲直性确定模块具体用于:

    若所述第一方向向量、所述第二方向向量、所述第三方向向量均相等,则确定所述衔接线段为直线;

    若所述第一方向向量、所述第二方向向量、所述第三方向向量中有任意两个向量不相等,则确定所述衔接线段为曲线。

    在本发明实施例中,所述曲线拟合模块具体用于:

    将参数化的三次多项式确定为曲线拟合模型,所述曲线拟合模型的自变量为所述第一点数据和所述衔接线段上的任意一点之间的距离,所述曲线拟合模型包括八个拟合参数;

    确定在所述第一点数据处,所述曲线拟合模型对应的第一表达式,在所述第二点数据处,所述曲线拟合模型对应的第二表达式;

    根据所述第一点数据处所述曲线拟合模型的偏导数为所述第一方向向量,所述第二点数据处所述曲线拟合模型的偏导数为所述第二方向向量,得到第一约束条件和第二约束条件;

    根据所述第一表达式、所述第二表达式、所述第一约束条件和所述第二约束条件确定所述八个拟合参数的取值;

    根据所述八个拟合参数的取值确定第一目标衔接线段。

    在本发明实施例中,所述装置还包括:

    直线拟合模型确定模块,用于若所述衔接线段为直线,则将包含三个参数的直线方程确定为直线拟合模型;

    直线拟合模块,用于利用所述直线拟合模型对所述衔接线段进行拟合,得到第二目标衔接线段。

    在本发明实施例中,所述直线拟合模块具体用于:

    确定所述第一点数据和所述第二点数据的横坐标相同时,所述直线拟合模型的第三表达式;

    确定所述第一点数据和所述第二点数据的纵坐标相同时,所述直线拟合模型的第四表达式;

    确定所述第一点数据和所述第二点数据的横坐标和纵坐标均不相同时,所述直线拟合模型的第五表达式;

    根据所述第三表达式、所述第四表达式和所述第五表达式,对所述衔接线段进行拟合。

    在本发明实施例中,所述曲线拟合模块具体用于:

    将参数化的三次多项式确定为曲线拟合模型,所述曲线拟合模型的自变量为所述第一点数据和所述衔接线段上的任意一点之间的距离,所述曲线拟合模型包括八个拟合参数;

    对所述第一方向向量设置第一长度调整参数、对所述第二方向向量设置第二长度调整参数;

    根据所述第一点数据处所述曲线拟合模型的偏导数为所述第一方向向量和所述第一长度调整参数的乘积,得到第三约束条件;

    根据所述第二点数据处所述曲线拟合模型的偏导数为所述第二方向向量和所述第二长度调整参数的乘积,得到第四约束条件;

    根据所述第一表达式、所述第二表达式、所述第三约束条件和所述第四约束条件确定所述八个拟合参数的取值;

    根据所述八个拟合参数的取值确定第一目标衔接线段。

    在本发明实施例中,所述曲线拟合模块进一步用于:

    根据期望得到的第一目标衔接线段的曲率半径,设置所述第一方向向量的第一长度调整参数的取值、所述第二方向向量的第二长度调整参数的取值。

    在本发明提供的又一实施例中,还提供了一种设备,所述设备包括处理器和存储器,所述存储器种存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由所述处理器加载并执行以实现本发明实施例中所述的点云数据的线性拟合方法。

    在本发明提供的又一实施例中,还提供了一种计算机可读存储介质,所述存储介质中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由处理器加载并执行以实现本发明实施例中所述的点云数据的线性拟合方法。

    在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk (SSD))等。

    需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。

    本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。

    以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本发明的保护范围内。

    一种点云数据的线性拟合方法和装置

    Technical field

    The present invention relates to the field of point cloud data processing technology, in particular to a linear fitting method and device for point cloud data.

    Background technology

    3D point cloud data is a collection of many points represented with 3D coordinate (x,y,z) data. Point cloud data can represent the surface three-dimensional information of an object, but these scatter representations have poor topological properties and redundant data. Line features are an important way to express the geometry of the surface of an object, and fitting scatter points into straight lines and curves can reduce the redundancy of point cloud data and truly and accurately characterize the geometry of the surface of an object.

    For point cloud data with a large number of points or complex linear features, in order to improve the accuracy of linear fitting, the point cloud data is segmented first, and then each sub-segment is fitted separately to obtain multiple line segment point clusters. In order to comprehensively express the geometry of the surface of the object, it is also necessary to further connect multiple line segment point clusters.

    At present, the linear fitting based on scatter points mainly ignores the z coordinate of the scatter point first, and only fits the (x,y) coordinate of the scatter point to a straight line or curve. This method is applied to the above scene where the line segment point cluster is connected, and the fitting of the connected segment is often not smooth enough, and it may not be connected with the two line segment point clusters before and after, so that the fitted line segment cannot accurately express the geometry of the object surface.

    Contents of the invention

    The present invention is intended to solve at least one of the technical problems existing in the prior art. To this end, the first aspect of the present invention proposes a linear fitting method for point cloud data, the method comprising:

    A linear fitting method for point cloud data, wherein the method comprises:

    Obtain the end point data of the first line segment point cluster to be connected and the start data of the second line segment point cluster to obtain the first point data and the second point data;

    The direction vector of the first line segment point cluster at the first point data, the direction vector of the second line segment point cluster at the second point data, the direction vector of the target vector composed of the first point data and the second point data are obtained, respectively, and the first direction vector, the second direction vector and the third party vector are obtained;

    According to the first direction vector, the second direction vector, and the third party vector, determine the straightness of the connection segment between the first line segment point cluster and the second line segment point cluster;

    If the coupling segment is a curve, the parametric curve fitting model is used to fit the coupling segment, and the first direction vector and the second direction vector are used as the fitting constraints to obtain the first target connection segment;

    The first target connection segment is used to connect the first segment point cluster and the second segment point cluster.

    The second aspect of the present invention proposes a linear fitting device for point cloud data, the apparatus comprising:

    The point data acquisition module is used to obtain the end point data of the first line segment point cluster to be connected and the start data of the second line segment point cluster to obtain the first point data and the second point data;

    a direction vector acquisition module for obtaining the direction vector of the first line segment point cluster at the first point data, the direction vector of the second line segment point cluster at the second point data, the direction vector of the target vector composed of the first point data and the second point data, respectively, to obtain the first direction vector, the second direction vector and the third party vector;

    a straightness determination module for determining the straightness of the connection segment between the first line segment point cluster and the second line segment point cluster according to the first direction vector, the second direction vector, and the third party vector;

    The curve fitting module is configured for fitting the coupling segment by using a parametric curve fitting model if the connection segment is a curve, and the first direction vector and the second direction vector are used as the fitting constraints to obtain the first target connection segment;

    A connection module for connecting the first segment point cluster and the second segment point cluster using the first target connection segment.

    The third aspect of the present invention proposes an electronic device, the electronic device includes a processor and a memory, the memory type stores at least one instruction, at least one program, code set or instruction set, and at least one instruction, at least one program, the code set or instruction set is loaded and executed by the processor to achieve a linear fitting method of point cloud data as described in the first aspect.

    The fourth aspect of the present invention proposes a computer-readable storage medium in which at least one instruction, at least one program, code set or instruction set is stored, and at least one instruction, at least one program, the code set or instruction set is loaded and executed by the processor to achieve a linear fitting method of point cloud data as described in the first aspect.

    Embodiments of the present invention have the following beneficial effects:

    In the embodiment of the present invention, the end data of the first line segment point cluster to be connected and the starting point data of the second line segment point cluster are obtained, and the first point data and the second point data are obtained; The direction vector of the first line segment point cluster at the first point of data, the direction vector of the second line segment point cluster at the second point data, the direction vector of the target vector composed of the first point data and the second point data were obtained respectively, and the first direction vector, the second direction vector and the third direction vector were obtained. According to the first direction vector, the second direction vector and the third direction vector, the curvature of the connection segment between the point cluster of the first line segment and the point cluster of the second line segment is determined. If the connection section is a curve, the parametric curve fitting model is used to fit the connection section, and the first direction vector and the second direction vector are used as the fitting constraints to obtain the first target connection section. Use the first target segment to connect the first segment point cluster and the second segment point cluster. This scheme enhances the adaptability to linear scenes by judging the straightness of the connection section. Moreover, the proposed scheme adds directional constraints during curve fitting, so that the effect of smooth connection can be achieved in continuous linear connection, so that the fitted line segment can accurately express the geometry of the object surface.

    Additional aspects and advantages of the present invention will be given in part in the following description, and some will become apparent from the following description, or learned through the practice of the present invention.

    Description of the drawings

    In order to more clearly illustrate the technical solution of the present invention, the following will be a brief introduction to the drawings that need to be used in the embodiment or prior art description. Obviously, the drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, without inventive labor, other drawings can be obtained on the basis of these drawings.

    FIG. 1 is a flow chart of the step of the linear fitting method of the first point cloud data provided by an embodiment of the present invention;

    FIG. 2 is a schematic diagram of the point cluster of the first line segment and the point cluster of the second line segment provided by an embodiment of the present invention;

    FIG. 3 is a flow chart of the steps of the linear fitting method of the second point cloud data provided in an embodiment of the present invention;

    FIG 4 (a) is a schematic diagram of the effect of an endpoint direction vector length on curve fitting provided for an embodiment of the present invention;

    FIG. 4 (b) is a schematic diagram of the effect of the length of an endpoint direction vector on curve fitting provided for an embodiment of the present invention;

    FIG. 5 is a flow chart of the step of the linear fitting method of the third point cloud data provided by an embodiment of the present invention;

    FIG 6 is a structural block diagram of a linear fitting device for point cloud data provided by an embodiment of the present invention.

    Specific embodiment

    The following will be combined with the accompanying drawings in the embodiment of the present invention, the technical solution in the embodiment of the present invention is clearly and completely described, obviously, the described embodiment is only a partial embodiment of the present invention, not all embodiments. Based on embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without performing inventive work fall within the scope of protection of the present invention.

    The present specification provides a method operation steps as described in embodiments or flowcharts, but based on routine or uncreative labor may include more or fewer operation steps. In the actual system or server product execution, may be executed sequentially or in parallel according to the method shown in the embodiment or the accompanying figure (e.g., parallel processor or multithreaded environment).

    FIG. 1 is a flow chart of the step of the linear fitting method of the first point cloud data provided by an embodiment of the present invention. The method can include the following steps:

    Step 101: Obtain the end point data of the first line segment point cluster to be connected and the start data of the second line segment point cluster to obtain the first point data and the second point data.

    For point cloud data with a large number of points or complex linear features, in order to improve the accuracy of linear fitting, the point cloud data is segmented first, and then each sub-segment is fitted separately to obtain multiple line segment point clusters. In order to comprehensively express the geometry of the surface of the object, it is also necessary to further connect multiple line segment point clusters.

    The first segment point cluster and the second segment point cluster are two subsegments of multiple subsegments divided into the original point cloud data, and it is currently necessary to smoothly connect the first segment point cluster and the second segment point cluster by linear fitting.

    The position of the first segment cluster is in front of the second segment point cluster. Get the coordinates of the point data located at the end of the first segment point cluster, that is, the end point data, and get the coordinates of the point data located at the beginning of the second segment point cluster, that is, the start point data. Use the endpoint data as the first point of data and the starting point data as the second point data.

    FIG. 2 is a schematic diagram of the first line segment point cluster and the second line segment point cluster provided by an embodiment of the present invention.

    As shown in Figure 2, L1 is the first segment point cluster and L2 is the second segment point cluster. The three-dimensional points P1(x1,y1,z1) and P2(x2,y2,z2) correspond to the plane points A(x1,y1) and B(x2,y2), respectively. Among them, point A is the end point of L1, point B is the starting point of L2, that is, point A(x1,y1) is the first point data, and point B(x2, y2) is the second point data.

    Step 102, respectively, obtain the direction vector of the first line segment point cluster at the first point data, the direction vector of the second line segment point cluster at the second point data, the direction vector of the target vector composed of the first point data and the second point data, respectively, to obtain the first direction vector, the second direction vector and the third party vector.

    The direction of a line in space is represented by a non-zero vector parallel to the line, which is called a direction vector of the line. The position of a line in space is fully determined by the point in space it passes through and one of its direction vectors.

    Here you also need to verify that the first point data and the second point data are the same point, and that both the first point data and the second point data have valid direction vectors. If the first point data and the second point data are the same point, or the first point data or the second point data do not have a valid direction vector, they will exit the solution process.

    After determining that neither of the above cases exists, obtain the first direction vector, the second direction vector, and the third direction vector.

    Referring to Figure 2, the direction vector of L1 at point A is , the direction vector of L2 at point B is , and the direction vector of the vector formed by point A and point B is .

    Among them, x5, y5 are calculated as follows:

    (1)

    (2)

    In this way, the first direction vector, the second direction vector, and the third direction vector are obtained.

    Step 103, according to the first direction vector, the second direction vector, the third party vector, determine the straightness of the connection segment between the first line segment point cluster and the second line segment point cluster.

    Specifically, if the direction of the first direction vector, the second direction vector, and the third-party vector are consistent, the connection segment between the first segment point cluster and the second line segment point cluster is a straight line, and if the direction of the first direction vector, the second direction vector, and the third direction vector are inconsistent, the connecting line segment is a curve.

    Step 104, if the coupling segment is a curve, the parametric curve fitting model is used to fit the coupling segment, and the first direction vector and the second direction vector are used as the fitting constraints to obtain the first target connection segment.

    If the coupling segment is a curve, the coupling segment needs to be fitted using a curve fitting model. The curve fitting model includes quadratic polynomial function, cubic polynomial function, semi-logarithmic function, Log-Log fitting function, etc., and the most suitable function can be selected as the curve fitting model in this scheme according to the linear characteristics of the point cloud data.

    In order to enhance the fitting effect and improve the smoothness of the connection section, the first direction vector and the second direction vector can be used as the fitting constraints, so that the direction change of the connection section is more compatible with the first direction vector and the second direction vector.

    Compared with the prior art that only uses the coordinates of the first point data and the second point data to fit the connection section, the first direction vector and the second direction vector are also used as the fitting constraints in this scheme, so that the effect of smooth connection can be achieved in a continuous linear connection.

    Step 105, using the first target connection segment to connect the first line segment point cluster and the second line segment point cluster.

    After fitting the first target connection segment, the first target connection segment is used to connect the first line segment point cluster and the second line segment point cluster, and the first line segment point cluster, the first target connection segment and the second line segment point cluster form a smooth line segment, which can truly and accurately represent the geometry of the object surface.

    In summary, in the embodiment of the present invention, the endpoint data of the first line segment point cluster to be connected and the starting point data of the second line segment point cluster are obtained, and the first point data and the second point data are obtained; The direction vector of the first line segment point cluster at the first point of data, the direction vector of the second line segment point cluster at the second point data, the direction vector of the target vector composed of the first point data and the second point data were obtained respectively, and the first direction vector, the second direction vector and the third direction vector were obtained. According to the first direction vector, the second direction vector and the third direction vector, the curvature of the connection segment between the point cluster of the first line segment and the point cluster of the second line segment is determined. If the connection section is a curve, the parametric curve fitting model is used to fit the connection section, and the first direction vector and the second direction vector are used as the fitting constraints to obtain the first target connection section. Use the first target segment to connect the first segment point cluster and the second segment point cluster. By judging the straightness of the coupling section, this scheme enhances the adaptability of the scheme to linear scenes. Moreover, the proposed scheme adds directional constraints during curve fitting, so that the effect of smooth connection can be achieved in continuous linear connection, so that the fitted line segment can accurately express the geometry of the object surface.

    FIG 3 is a flow chart of the steps of the linear fitting method of the second point cloud data provided in an embodiment of the present invention. The method can include the following steps:

    Step 201: Obtain the endpoint data of the first line segment point cluster to be connected and the start data of the second line segment point cluster to obtain the first point data and the second point data.

    In the embodiment of the present invention, step 201 may refer to step 101, which is not repeated herein.

    Step 202, respectively, obtain the first point data, the second point data, the first point data and the second point data of the wiring direction vector, respectively, to obtain the first direction vector, the second direction vector and the third party vector; The first direction vector, the second direction vector, and the third direction vector are all unit vectors.

    In the embodiment of the present invention, the unit vector refers to a vector with a modulus equal to 1. Since it is a non-zero vector, the unit vector has a definite orientation.

    The first direction vector, the second direction vector, and the third direction vector are all unit vectors, which can facilitate subsequent determination of whether the three direction vectors are on the same straight line.

    Step 203, if any two vectors in the first direction vector, the second direction vector, and the third party vector are not equal, the connection segment is determined to be a curve.

    Since the first direction vector, the second direction vector, and the third party vector are all unit vectors, all only need to determine whether the three are equal to determine whether the three are on the same straight line, thereby determining whether the connection segment is a curve or a straight line.

    If any two vectors of the three are not equal, it means that the three are not in a straight line, then the connection segment is a curve.

    As shown in the example in Figure 2, the first direction vector at point A is , the second direction vector at point B is , the third direction vector corresponding to the vector is , V1≠ V2 ≠ V3, indicating that the connection section L3 is a curve.

    Step 204, if the coupling segment is a curve, the parametric cubic polynomial is determined as a curve fitting model, the independent variable of the curve fitting model is the distance between the first point data and any point on the coupling segment, and the curve fitting model includes eight fitting parameters.

    In the embodiment of the present invention, the parametric cubic polynomial may be expressed as:

    (3)

    Among them, A1, B1, C1, D1, A2, B2, C2, and D2 are the eight fitting parameters. The independent variable t is the distance between the first point and any point on the coupling section. , where , that is, T is the distance between the first point of data and the second point of data. At the first point of data, t=0, and at the second point of data, t=T.

    Using a parametric cubic polynomial as a curve fitting model is sufficient for fitting between two points, and can solve the problem that one x coordinate corresponds to multiple y coordinates.

    After step 204, you may choose to perform steps 205 - 208, or you may choose to perform steps 209 - 213.

    Step 205, determine the first expression corresponding to the curve fitting model at the first point of data, and at the second point of data, the second expression corresponding to the curve fitting model.

    Based on the scenario shown in FIG. 2, according to the curve fitting model selected in step 204, a parametric cubic polynomial model is required between points A and B for smooth fitting, so the fitted curve must pass through points A (x1,y1) and B (x2,y2), and the forward directions at points A and B are respectively.

    Specifically, the coordinates of the first point data are substituted into the curve fitting model to obtain the first expression, and the coordinates of the second point data are substituted into the curve fitting model to obtain the second expression.

    The first point data A(x1,y1) and t=0 are substituted into the curve fitting model to obtain the first expression:

    (4)

    Substituting the second point data B(x2,y2) and t=T into the curve fitting model to obtain the second expression:

    (5)

    Step 206, according to the curve at the first point of data to fit the partial derivative of the model is the first direction vector, the second point data at the curve fitting model of the partial derivative is the second direction vector, the first constraint and the second constraint are obtained.

    The partial derivative of the curve-fitting model at the first point of data is the first direction vector, as follows:

    (6)

    The partial derivative of the curve-fitting model at the second point of data is the second direction vector, as follows:

    (7)

    Equations (6) and (7) above are the first and second constraints, respectively.

    Step 207, according to the first expression, the second expression, the first constraint and the second constraint determine the values of the eight fitted parameters.

    By combining the equations of the first expression, the second expression, the first constraint and the second constraint, the values of the eight fitted parameters A1, B1, C1, D1, A2, B2, C2, and D2 can be obtained.

    Step 208, according to the values of the eight fitting parameters to determine the first target connection segment.

    After obtaining the values of the eight fitted parameters, substitute them into equation (3) to obtain the expression of the first target connection segment.

    Step 209, set the first length adjustment parameter for the first direction vector, and set the second length adjustment parameter for the second direction vector.

    In order to enhance the generalization ability of the curve fitting model of this scheme to adapt to multi-scene fitting, the parameter adjustment coefficient is set to change the length of the direction vector at the first point of data and the second point of data. Specifically, the first length adjustment parameter is set for the first direction vector, and the second length adjustment parameter is set for the second direction vector.

    Thus, the first adjustment vector of the direction vector at point A is , and the second adjustment vector of the direction vector at point B is .

    Thus, according to the unit vector of the first direction, the first relationship between the first length adjustment parameter and the abscissa and ordinate of the first point data is obtained; According to the second direction vector as the unit vector, the second relationship between the second length adjustment parameter and the abscissa and ordinate of the second point data is obtained.

    The first and second direction vectors are unit vectors, then there are:

    (8)

    According to Equation (8), the first and second relations can be obtained as follows:

    (9)

    It can be seen from the first and second relations that the first and second direction vectors are converted from constants to variables due to the addition of length adjustment parameters.

    Step 210, according to the partial derivative of the curve fitting model at the first point of data, is the product of the first direction vector and the first length adjustment parameter, and the third constraint is obtained.

    At the first point of data, t=0, the partial derivative of the curve fitting model at the first point of data is the product of the first direction vector and the first length adjustment parameter, and the third constraint is as follows:

    (10)

    Step 211, according to the partial derivative of the curve fitting model at the second point of data, is the product of the second direction vector and the second length adjustment parameter, and the fourth constraint is obtained.

    At the second point of data, t=T, the partial derivative of the curve fitting model at the second point of data is the product of the second direction vector and the second length adjustment parameter, and the fourth constraint is as follows:

    (11)

    Step 212, according to the first expression, the second expression, the third constraint and the fourth constraint are fitted to the coupling segment.

    By combining the first expression, the second expression, the third constraint and the fourth constraint, the values of the eight fitted parameters A1, B1, C1, D1, A2, B2, C2, and D2 can be obtained. Thereinto:

    (12)

    Step 213: Determine the first target connection segment according to the values of the eight fitting parameters.

    Substituting these eight values into equation (5) yields the first target connection segment.

    In one possible embodiment, the first length adjustment parameter is set for the first direction vector, and the second length adjustment parameter is set for the second direction vector, comprising:

    According to the radius of curvature of the desired first target connection segment, the value of the first length adjustment parameter of the first direction vector and the value of the second length adjustment parameter of the second direction vector are set.

    In an embodiment of the present invention, after a plurality of tests, the results show that the first length adjustment parameter and the second length adjustment parameter will have an impact on the curvature of the first coupling segment.

    FIG 4 (a) is a schematic diagram of the effect of the length of an endpoint direction vector on curve fitting provided by an embodiment of the present invention. FIG 4(b) is a schematic diagram of the effect of the length of an endpoint direction vector on curve fitting provided for an embodiment of the present invention.

    As shown in Fig. 4(a) and Fig. 4(b), when the first adjustment vector at point A is V4 and the second adjustment vector at point B is V2, the first target connection segment is curve L4; When the first adjustment vector at point A is V1 and the second adjustment vector at point B is also V2, the first target connection segment is curve L3, where V4 and V1 are parallel in the direction. When the length of V4 is greater than the length of V1, it can be seen from Figure 4(a) that curve L4 is more convex at endpoint A than curve L3; When the length of V4 is less than the length of V1, it can be seen from Figure 4(b) that curve L3 is more convex at endpoint A than curve L4. It follows that the curvature of the curve of the first target junction is proportional to the length of the first length adjustment parameter corresponding to the start endpoint. Through similar experiments, the influence of the second length adjustment parameter corresponding to the termination node on the curvature of the curve of the first target coupling section can also be obtained.

    Therefore, as long as the appropriate first length adjustment parameters and second length adjustment parameters are calculated according to the feature extraction and solution of the fitted scene, the fitting curve with suitable curvature can be generated, so the linear fitting method with length adjustment parameters has stronger adaptability and generalization ability for multiple scenes.

    Step 214, using the first target connection segment to connect the first line segment point cluster and the second line segment point cluster.

    In the embodiment of the present invention, step 214 may refer to step 105, which is not repeated herein.

    In summary, in the embodiment of the present invention, in the scenario of linear fitting between two points of endpoint coordinates and direction constraints, the comparison of the direction vector composed of two points and the direction vector of the two endpoints themselves determines whether the two points are straight lines or curves or abnormal exits, which provides a reference for the subsequent selection of the fitting model.

    Moreover, on the basis of the curve fitting model, the constraints of the endpoint coordinates and direction vector are added, so that the curve fitting connection between the two points is smoother.

    In addition, on the basis of the curve fitting model, a curve fitting method with length adjustment parameters based on endpoint and direction constraints is proposed, which enhances the adaptability and generalization ability of the scheme to multiple scenarios by increasing the length adjustment parameters.

    FIG 5 is a step flow chart of a linear fitting method for the third point cloud data provided by an embodiment of the present invention. The method can include the following steps:

    Step 301: Obtain the endpoint data of the first line segment point cluster to be connected and the start data of the second line segment point cluster, and obtain the first point data and the second point data.

    In the embodiment of the present invention, step 301 may refer to step 101, which is not repeated herein.

    Step 302, respectively, obtain the first point data, the second point data, the first point data and the second point data of the wiring direction vector, respectively, to obtain the first direction vector, the second direction vector and the third party vector; The first direction vector, the second direction vector, and the third direction vector are all unit vectors.

    In the embodiment of the present invention, step 302 may refer to step 202, which will not be repeated herein.

    Step 303, if the first direction vector, the second direction vector, and the third party vector are all equal, the connection segment is determined to be a straight line.

    Since the first direction vector, the second direction vector, and the third party vector are all unit vectors, all only need to determine whether the three are equal to determine whether the three are on the same straight line, thereby determining whether the connection segment is a curve or a straight line.

    If the three direction vectors are equal, it means that the three direction vectors are in a straight line, and the connection segment is a straight line.

    Step 304, if the connection segment is a straight line, the linear equation containing three parameters is determined as a straight line fitting model.

    When it is determined that the connection segment between the start point and the end point is a straight line, select the straight line equation as the straight line fitting model, and the straight line fitting model is as follows:

    (13)

    Among them, E, F, and G are the three fitting parameters.

    Step 305, the linear fitting model is used to fit the connection segment, and the second target connection segment is obtained.

    By fitting the straight line by fitting the coordinate values of the first point data and the second point data on the straight line fitting model, the values of the three fitting parameters can be obtained, and the values of the three fitted parameters are substituted into the equation (13) to obtain the second target connection segment.

    In one possible embodiment, the fitting of the coupling segment using the straight line fitting model, comprising steps 3051-3054:

    Step 3051, when determining that the abscissa of the first point data and the second point data is the same, the line fits the third expression of the model.

    Substituting the first data A(x1,y1) and the second data B(x2,y2) into equation (13) yields:

    (14)

    Subtract the two equations in equation (14) to yield:

    (15)

    When the abscissa of the first point data is the same as the second point data, the third expression is obtained from equation (15) as follows:

    (16)

    Step 3052, when determining that the ordinate of the first point data and the second point data are the same, the line fits the fourth expression of the model.

    When the abscissa of the first point data is the same as the second point data, the fourth expression is obtained from equation (15) as follows:

    (17)

    Step 3053, when determining that the abscissa and ordinate of the first point data and the second point data are different, the line fits the fifth expression of the model.

    When determining that the abscissa and ordinate of the first point data and the second point data are different, and the fifth expression is obtained from equation (15) as follows:

    (18)

    Step 3054, according to the third expression, the fourth expression and the fifth expression, the coupling segment is fitted.

    By combining the third expression, the fourth expression, and the fifth expression, the values of the three fitted parameters E, F, and G can be obtained.

    Substituting these three values into equation (13) yields a second target coupling segment.

    In summary, in an embodiment of the present invention, the first direction vector, the second direction vector, and the third party direction vector are used to determine whether the connection segment is a straight line or a curve, and the judgment method is simple and accurate, which is convenient to use different fitting methods to fit the connection segment later. In the case of determining that the connection segment is a straight line, the linear equation including three fitting parameters is used to fit the fitting efficiency and fitting accuracy.

    FIG 6 is a structural block diagram of a linear fitting device for point cloud data provided by an embodiment of the present invention. The device 400 comprises:

    Point data acquisition module 401, for obtaining the end point data of the first line segment point cluster to be connected and the start data of the second line segment point cluster, to obtain the first point data and the second point data;

    The direction vector acquisition module 402 is configured to obtain the direction vector of the first line segment point cluster at the first point data, the direction vector of the second line segment point cluster at the second point data, the direction vector of the target vector composed of the first point data and the second point data, respectively, to obtain the first direction vector, the second direction vector and the third party vector;

    the straightness determination module 403 is configured to determine the straightness of the connection segment between the first segment point cluster and the second line segment point cluster according to the first direction vector, the second direction vector, and the third party vector vector;

    The curve fitting module 404 is configured for fitting the coupling segment by using a parametric curve fitting model if the connecting segment is a curve, and the first direction vector and the second direction vector are used as the fitting constraints to obtain the first target connection segment;

    The connection module 405 is configured to connect the first segment point cluster and the second segment point cluster using the first target connection segment.

    Those skilled in the art can clearly understand that for the convenience and conciseness of the description, the specific working process of the system, device and unit described above may refer to the corresponding process in the embodiment of the foregoing method, and will not be repeated herein.

    In an embodiment of the present invention, the first direction vector, the second direction vector, and the third party vector are all unit vectors.

    In an embodiment of the present invention, the straightness determination module is specifically used for:

    If the first direction vector, the second direction vector, and the third direction vector are all equal, the connection segment is determined to be a straight line;

    If any two vectors in the first direction vector, the second direction vector, and the third direction vector are not equal, the connection segment is determined to be a curve.

    In an embodiment of the present invention, the curve fitting module is specifically used for:

    The parametric cubic polynomial is determined as a curve fitting model, the independent variable of the curve fitting model is the distance between the first point data and any point on the connecting segment, and the curve fitting model includes eight fitting parameters;

    determine the first expression corresponding to the curve-fitting model at the first point data, and at the second point data, the second expression corresponding to the curve-fitting model;

    The partial derivative of the curve-fitting model according to the first point data is the first direction vector, and the partial derivative of the curve fitting model at the second point data is the second direction vector, and the first constraint and the second constraint are obtained;

    determine the values of the eight fitted parameters according to the first expression, the second expression, the first constraint and the second constraint;

    The first target connection segment is determined according to the values of the eight fitting parameters.

    In an embodiment of the present invention, the apparatus further comprises:

    The linear fitting model determination module is used to determine the linear equation containing three parameters as a linear fitting model if the connecting segment is a straight line;

    The linear fitting module is used to fit the connecting segment using the linear fitting model to obtain the second target connecting segment.

    In the embodiment of the present invention, the straight line fitting module is specifically used for:

    When determining that the abscissa of the first point data and the second point data is the same, the third expression of the straight line fitting model;

    When determining that the ordinate of the first point data and the second point data are the same, the fourth expression of the straight line fitting the model;

    When determining that the abscissa and ordinate of the first point data and the second point data are different, the fifth expression of the straight line fitting model;

    According to the third expression, the fourth expression, and the fifth expression, the coupling segment is fitted.

    In an embodiment of the present invention, the curve fitting module is specifically used for:

    The parametric cubic polynomial is determined as a curve fitting model, the independent variable of the curve fitting model is the distance between the first point data and any point on the connecting segment, and the curve fitting model includes eight fitting parameters;

    set the first length adjustment parameter for the first direction vector and the second length adjustment parameter for the second direction vector;

    According to the partial derivative of the curve fitting model at the first point data, the product of the first direction vector and the first length adjustment parameter is obtained;

    According to the partial derivative of the curve fitting model at the second point data, the product of the second direction vector and the second length adjustment parameter is obtained;

    determine the values of the eight fitted parameters according to the first expression, the second expression, the third constraint and the fourth constraint;

    The first target connection segment is determined according to the values of the eight fitting parameters.

    In an embodiment of the present invention, the curve fitting module is further used for:

    According to the radius of curvature of the desired first target connection segment, the value of the first length adjustment parameter of the first direction vector and the value of the second length adjustment parameter of the second direction vector are set.

    In yet another embodiment provided by the present invention, the device also provides a device comprising a processor and a memory, the memory type stores at least one instruction, at least one program, code set or instruction set, said at least one instruction, at least one piece of the program, the code set or instruction set is loaded and executed by the processor to achieve a linear fitting method of point cloud data described in the embodiment of the present invention.

    In yet another embodiment provided by the present invention, a computer-readable storage medium is also provided in which at least one instruction, at least one program, code set or instruction set is stored, and at least one instruction, at least one program, said code set or instruction set is loaded and executed by the processor to achieve a linear fitting method of point cloud data described in embodiments of the present invention.

    In the above embodiments, may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing the computer program instructions on the computer, the process or function described in accordance with the embodiment of the present invention is produced in whole or in part. The computer may be a general-purpose computer, a special computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) to another website site, computer, server or data center. The computer-readable storage medium may be any usable medium that the computer can access or a server, data center and other data storage device containing one or more available media integration. The available media may be magnetic media, (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid state disk (SSD)) and the like.

    It is important to note that in this article, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another, without necessarily requiring or implying any such actual relationship or order between these entities or operations. Further, the terms "comprise", "comprise" or any other variation thereof are intended to cover non-exclusive inclusions such that a process, method, article or apparatus comprising a range of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such processes, methods, articles or equipment. Without further limitation, the elements qualified by the statement "including a..." do not exclude the existence of other identical elements in the process, method, article or apparatus comprising said elements.

    Each embodiment in this specification is described in a relevant manner, and the same similar parts between each embodiment can refer to each other, and each embodiment focuses on the difference from other embodiments. In particular, for system embodiments, because it is basically similar to the method embodiment, the description is relatively simple, and the relevant points can be referred to the partial description of the method embodiment.

    The foregoing is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modification, equivalent substitution, improvement, etc. made within the spirit and principles of the present invention is included in the scope of protection of the present invention.

    Linear fitting method and device for point cloud data

    Technical field

    The present invention relates to the field of point cloud data processing technology, in particular to a linear fitting method and device for point cloud data.

    Background technology

    3D point cloud data is a collection of many points represented with 3D coordinate (x,y,z) data. Point cloud data can represent the surface three-dimensional information of an object, but these scatter representations have poor topological properties and redundant data. Line features are an important way to express the geometry of the surface of an object, and fitting scatter points into straight lines and curves can reduce the redundancy of point cloud data and truly and accurately characterize the geometry of the surface of an object.

    For point cloud data with a large number of points or complex linear features, in order to improve the accuracy of linear fitting, the point cloud data is segmented first, and then each sub-segment is fitted separately to obtain multiple line segment point clusters. In order to comprehensively express the geometry of the surface of the object, it is also necessary to further connect multiple line segment point clusters.

    At present, the linear fitting based on scatter points mainly ignores the z coordinate of the scatter point first, and only fits the (x,y) coordinate of the scatter point to a straight line or curve. This method is applied to the above scene where the line segment point cluster is connected, and the fitting of the connected segment is often not smooth enough, and it may not be connected with the two line segment point clusters before and after, so that the fitted line segment cannot accurately express the geometry of the object surface.

    Contents of the invention

    The present invention is intended to solve at least one of the technical problems existing in the prior art. To this end, the first aspect of the present invention proposes a linear fitting method for point cloud data, the method comprising:

    A linear fitting method for point cloud data, wherein the method comprises:

    Obtain the end point data of the first line segment point cluster to be connected and the start data of the second line segment point cluster to obtain the first point data and the second point data;

    The direction vector of the first line segment point cluster at the first point data, the direction vector of the second line segment point cluster at the second point data, the direction vector of the target vector composed of the first point data and the second point data are obtained, respectively, and the first direction vector, the second direction vector and the third party vector are obtained;

    According to the first direction vector, the second direction vector, and the third party vector, determine the straightness of the connection segment between the first line segment point cluster and the second line segment point cluster;

    If the coupling segment is a curve, the parametric curve fitting model is used to fit the coupling segment, and the first direction vector and the second direction vector are used as the fitting constraints to obtain the first target connection segment;

    The first target connection segment is used to connect the first segment point cluster and the second segment point cluster.

    The second aspect of the present invention proposes a linear fitting device for point cloud data, the apparatus comprising:

    The point data acquisition module is used to obtain the end point data of the first line segment point cluster to be connected and the start data of the second line segment point cluster to obtain the first point data and the second point data;

    a direction vector acquisition module for obtaining the direction vector of the first line segment point cluster at the first point data, the direction vector of the second line segment point cluster at the second point data, the direction vector of the target vector composed of the first point data and the second point data, respectively, to obtain the first direction vector, the second direction vector and the third party vector;

    a straightness determination module for determining the straightness of the connection segment between the first line segment point cluster and the second line segment point cluster according to the first direction vector, the second direction vector, and the third party vector;

    The curve fitting module is configured for fitting the coupling segment by using a parametric curve fitting model if the connection segment is a curve, and the first direction vector and the second direction vector are used as the fitting constraints to obtain the first target connection segment;

    A connection module for connecting the first segment point cluster and the second segment point cluster using the first target connection segment.

    The third aspect of the present invention proposes an electronic device, the electronic device includes a processor and a memory, the memory type stores at least one instruction, at least one program, code set or instruction set, and at least one instruction, at least one program, the code set or instruction set is loaded and executed by the processor to achieve a linear fitting method of point cloud data as described in the first aspect.

    The fourth aspect of the present invention proposes a computer-readable storage medium in which at least one instruction, at least one program, code set or instruction set is stored, and at least one instruction, at least one program, the code set or instruction set is loaded and executed by the processor to achieve a linear fitting method of point cloud data as described in the first aspect.

    Embodiments of the present invention have the following beneficial effects:

    In the embodiment of the present invention, the end data of the first line segment point cluster to be connected and the starting point data of the second line segment point cluster are obtained, and the first point data and the second point data are obtained; The direction vector of the first line segment point cluster at the first point of data, the direction vector of the second line segment point cluster at the second point data, the direction vector of the target vector composed of the first point data and the second point data were obtained respectively, and the first direction vector, the second direction vector and the third direction vector were obtained. According to the first direction vector, the second direction vector and the third direction vector, the curvature of the connection segment between the point cluster of the first line segment and the point cluster of the second line segment is determined. If the connection section is a curve, the parametric curve fitting model is used to fit the connection section, and the first direction vector and the second direction vector are used as the fitting constraints to obtain the first target connection section. Use the first target segment to connect the first segment point cluster and the second segment point cluster. This scheme enhances the adaptability to linear scenes by judging the straightness of the connection section. Moreover, the proposed scheme adds directional constraints during curve fitting, so that the effect of smooth connection can be achieved in continuous linear connection, so that the fitted line segment can accurately express the geometry of the object surface.

    Additional aspects and advantages of the present invention will be given in part in the following description, and some will become apparent from the following description, or learned through the practice of the present invention.

    Description of the drawings

    In order to more clearly illustrate the technical solution of the present invention, the following will be a brief introduction to the drawings that need to be used in the embodiment or prior art description. Obviously, the drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, without inventive labor, other drawings can be obtained on the basis of these drawings.

    FIG. 1 is a flow chart of the step of the linear fitting method of the first point cloud data provided by an embodiment of the present invention;

    FIG. 2 is a schematic diagram of the point cluster of the first line segment and the point cluster of the second line segment provided by an embodiment of the present invention;

    FIG. 3 is a flow chart of the steps of the linear fitting method of the second point cloud data provided in an embodiment of the present invention;

    FIG 4 (a) is a schematic diagram of the effect of an endpoint direction vector length on curve fitting provided for an embodiment of the present invention;

    FIG. 4 (b) is a schematic diagram of the effect of the length of an endpoint direction vector on curve fitting provided for an embodiment of the present invention;

    FIG. 5 is a flow chart of the step of the linear fitting method of the third point cloud data provided by an embodiment of the present invention;

    FIG 6 is a structural block diagram of a linear fitting device for point cloud data provided by an embodiment of the present invention.

    Specific embodiment

    The following will be combined with the accompanying drawings in the embodiment of the present invention, the technical solution in the embodiment of the present invention is clearly and completely described, obviously, the described embodiment is only a partial embodiment of the present invention, not all embodiments. Based on embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without performing inventive work fall within the scope of protection of the present invention.

    The present specification provides a method operation steps as described in embodiments or flowcharts, but based on routine or uncreative labor may include more or fewer operation steps. In the actual system or server product execution, may be executed sequentially or in parallel according to the method shown in the embodiment or the accompanying figure (e.g., parallel processor or multithreaded environment).

    FIG. 1 is a flow chart of the step of the linear fitting method of the first point cloud data provided by an embodiment of the present invention. The method can include the following steps:

    Step 101: Obtain the end point data of the first line segment point cluster to be connected and the start data of the second line segment point cluster to obtain the first point data and the second point data.

    For point cloud data with a large number of points or complex linear features, in order to improve the accuracy of linear fitting, the point cloud data is segmented first, and then each sub-segment is fitted separately to obtain multiple line segment point clusters. In order to comprehensively express the geometry of the surface of the object, it is also necessary to further connect multiple line segment point clusters.

    The first segment point cluster and the second segment point cluster are two subsegments of multiple subsegments divided into the original point cloud data, and it is currently necessary to smoothly connect the first segment point cluster and the second segment point cluster by linear fitting.

    The position of the first segment cluster is in front of the second segment point cluster. Get the coordinates of the point data located at the end of the first segment point cluster, that is, the end point data, and get the coordinates of the point data located at the beginning of the second segment point cluster, that is, the start point data. Use the endpoint data as the first point of data and the starting point data as the second point data.

    FIG. 2 is a schematic diagram of the first line segment point cluster and the second line segment point cluster provided by an embodiment of the present invention.

    As shown in Figure 2, L1 is the first segment point cluster and L2 is the second segment point cluster. The three-dimensional points P1(x1,y1,z1) and P2(x2,y2,z2) correspond to the plane points A(x1,y1) and B(x2,y2), respectively. Among them, point A is the end point of L1, point B is the starting point of L2, that is, point A(x1,y1) is the first point data, and point B(x2, y2) is the second point data.

    Step 102, respectively, obtain the direction vector of the first line segment point cluster at the first point data, the direction vector of the second line segment point cluster at the second point data, the direction vector of the target vector composed of the first point data and the second point data, respectively, to obtain the first direction vector, the second direction vector and the third party vector.

    The direction of a line in space is represented by a non-zero vector parallel to the line, which is called a direction vector of the line. The position of a line in space is fully determined by the point in space it passes through and one of its direction vectors.

    Here you also need to verify that the first point data and the second point data are the same point, and that both the first point data and the second point data have valid direction vectors. If the first point data and the second point data are the same point, or the first point data or the second point data do not have a valid direction vector, they will exit the solution process.

    After determining that neither of the above cases exists, obtain the first direction vector, the second direction vector, and the third direction vector.

    Referring to Figure 2, the direction vector of L1 at point A is , the direction vector of L2 at point B is , and the direction vector of the vector formed by point A and point B is .

    Among them, x5, y5 are calculated as follows:

    (1)

    (2)

    In this way, the first direction vector, the second direction vector, and the third direction vector are obtained.

    Step 103, according to the first direction vector, the second direction vector, the third party vector, determine the straightness of the connection segment between the first line segment point cluster and the second line segment point cluster.

    Specifically, if the direction of the first direction vector, the second direction vector, and the third-party vector are consistent, the connection segment between the first segment point cluster and the second line segment point cluster is a straight line, and if the direction of the first direction vector, the second direction vector, and the third direction vector are inconsistent, the connecting line segment is a curve.

    Step 104, if the coupling segment is a curve, the parametric curve fitting model is used to fit the coupling segment, and the first direction vector and the second direction vector are used as the fitting constraints to obtain the first target connection segment.

    If the coupling segment is a curve, the coupling segment needs to be fitted using a curve fitting model. The curve fitting model includes quadratic polynomial function, cubic polynomial function, semi-logarithmic function, Log-Log fitting function, etc., and the most suitable function can be selected as the curve fitting model in this scheme according to the linear characteristics of the point cloud data.

    In order to enhance the fitting effect and improve the smoothness of the connection section, the first direction vector and the second direction vector can be used as the fitting constraints, so that the direction change of the connection section is more compatible with the first direction vector and the second direction vector.

    Compared with the prior art that only uses the coordinates of the first point data and the second point data to fit the connection section, the first direction vector and the second direction vector are also used as the fitting constraints in this scheme, so that the effect of smooth connection can be achieved in a continuous linear connection.

    Step 105, using the first target connection segment to connect the first line segment point cluster and the second line segment point cluster.

    After fitting the first target connection segment, the first target connection segment is used to connect the first line segment point cluster and the second line segment point cluster, and the first line segment point cluster, the first target connection segment and the second line segment point cluster form a smooth line segment, which can truly and accurately represent the geometry of the object surface.

    In summary, in the embodiment of the present invention, the endpoint data of the first line segment point cluster to be connected and the starting point data of the second line segment point cluster are obtained, and the first point data and the second point data are obtained; The direction vector of the first line segment point cluster at the first point of data, the direction vector of the second line segment point cluster at the second point data, the direction vector of the target vector composed of the first point data and the second point data were obtained respectively, and the first direction vector, the second direction vector and the third direction vector were obtained. According to the first direction vector, the second direction vector and the third direction vector, the curvature of the connection segment between the point cluster of the first line segment and the point cluster of the second line segment is determined. If the connection section is a curve, the parametric curve fitting model is used to fit the connection section, and the first direction vector and the second direction vector are used as the fitting constraints to obtain the first target connection section. Use the first target segment to connect the first segment point cluster and the second segment point cluster. By judging the straightness of the coupling section, this scheme enhances the adaptability of the scheme to linear scenes. Moreover, the proposed scheme adds directional constraints during curve fitting, so that the effect of smooth connection can be achieved in continuous linear connection, so that the fitted line segment can accurately express the geometry of the object surface.

    FIG 3 is a flow chart of the steps of the linear fitting method of the second point cloud data provided in an embodiment of the present invention. The method can include the following steps:

    Step 201: Obtain the endpoint data of the first line segment point cluster to be connected and the start data of the second line segment point cluster to obtain the first point data and the second point data.

    In the embodiment of the present invention, step 201 may refer to step 101, which is not repeated herein.

    Step 202, respectively, obtain the first point data, the second point data, the first point data and the second point data of the wiring direction vector, respectively, to obtain the first direction vector, the second direction vector and the third party vector; The first direction vector, the second direction vector, and the third direction vector are all unit vectors.

    In the embodiment of the present invention, the unit vector refers to a vector with a modulus equal to 1. Since it is a non-zero vector, the unit vector has a definite orientation.

    The first direction vector, the second direction vector, and the third direction vector are all unit vectors, which can facilitate subsequent determination of whether the three direction vectors are on the same straight line.

    Step 203, if any two vectors in the first direction vector, the second direction vector, and the third party vector are not equal, the connection segment is determined to be a curve.

    Since the first direction vector, the second direction vector, and the third party vector are all unit vectors, all only need to determine whether the three are equal to determine whether the three are on the same straight line, thereby determining whether the connection segment is a curve or a straight line.

    If any two vectors of the three are not equal, it means that the three are not in a straight line, then the connection segment is a curve.

    As shown in the example in Figure 2, the first direction vector at point A is , the second direction vector at point B is , the third direction vector corresponding to the vector is , V1≠ V2 ≠ V3, indicating that the connection section L3 is a curve.

    Step 204, if the coupling segment is a curve, the parametric cubic polynomial is determined as a curve fitting model, the independent variable of the curve fitting model is the distance between the first point data and any point on the coupling segment, and the curve fitting model includes eight fitting parameters.

    In the embodiment of the present invention, the parametric cubic polynomial may be expressed as:

    (3)

    Among them, A1, B1, C1, D1, A2, B2, C2, and D2 are the eight fitting parameters. The independent variable t is the distance between the first point and any point on the coupling section. , where , that is, T is the distance between the first point of data and the second point of data. At the first point of data, t=0, and at the second point of data, t=T.

    Using a parametric cubic polynomial as a curve fitting model is sufficient for fitting between two points, and can solve the problem that one x coordinate corresponds to multiple y coordinates.

    After step 204, you may choose to perform steps 205 - 208, or you may choose to perform steps 209 - 213.

    Step 205, determine the first expression corresponding to the curve fitting model at the first point of data, and at the second point of data, the second expression corresponding to the curve fitting model.

    Based on the scenario shown in FIG. 2, according to the curve fitting model selected in step 204, a parametric cubic polynomial model is required between points A and B for smooth fitting, so the fitted curve must pass through points A (x1,y1) and B (x2,y2), and the forward directions at points A and B are respectively.

    Specifically, the coordinates of the first point data are substituted into the curve fitting model to obtain the first expression, and the coordinates of the second point data are substituted into the curve fitting model to obtain the second expression.

    The first point data A(x1,y1) and t=0 are substituted into the curve fitting model to obtain the first expression:

    (4)

    Substituting the second point data B(x2,y2) and t=T into the curve fitting model to obtain the second expression:

    (5)

    Step 206, according to the curve at the first point of data to fit the partial derivative of the model is the first direction vector, the second point data at the curve fitting model of the partial derivative is the second direction vector, the first constraint and the second constraint are obtained.

    The partial derivative of the curve-fitting model at the first point of data is the first direction vector, as follows:

    (6)

    The partial derivative of the curve-fitting model at the second point of data is the second direction vector, as follows:

    (7)

    Equations (6) and (7) above are the first and second constraints, respectively.

    Step 207, according to the first expression, the second expression, the first constraint and the second constraint determine the values of the eight fitted parameters.

    By combining the equations of the first expression, the second expression, the first constraint and the second constraint, the values of the eight fitted parameters A1, B1, C1, D1, A2, B2, C2, and D2 can be obtained.

    Step 208, according to the values of the eight fitting parameters to determine the first target connection segment.

    After obtaining the values of the eight fitted parameters, substitute them into equation (3) to obtain the expression of the first target connection segment.

    Step 209, set the first length adjustment parameter for the first direction vector, and set the second length adjustment parameter for the second direction vector.

    In order to enhance the generalization ability of the curve fitting model of this scheme to adapt to multi-scene fitting, the parameter adjustment coefficient is set to change the length of the direction vector at the first point of data and the second point of data. Specifically, the first length adjustment parameter is set for the first direction vector, and the second length adjustment parameter is set for the second direction vector.

    Thus, the first adjustment vector of the direction vector at point A is , and the second adjustment vector of the direction vector at point B is .

    Thus, according to the unit vector of the first direction, the first relationship between the first length adjustment parameter and the abscissa and ordinate of the first point data is obtained; According to the second direction vector as the unit vector, the second relationship between the second length adjustment parameter and the abscissa and ordinate of the second point data is obtained.

    The first and second direction vectors are unit vectors, then there are:

    (8)

    According to Equation (8), the first and second relations can be obtained as follows:

    (9)

    It can be seen from the first and second relations that the first and second direction vectors are converted from constants to variables due to the addition of length adjustment parameters.

    Step 210, according to the partial derivative of the curve fitting model at the first point of data, is the product of the first direction vector and the first length adjustment parameter, and the third constraint is obtained.

    At the first point of data, t=0, the partial derivative of the curve fitting model at the first point of data is the product of the first direction vector and the first length adjustment parameter, and the third constraint is as follows:

    (10)

    Step 211, according to the partial derivative of the curve fitting model at the second point of data, is the product of the second direction vector and the second length adjustment parameter, and the fourth constraint is obtained.

    At the second point of data, t=T, the partial derivative of the curve fitting model at the second point of data is the product of the second direction vector and the second length adjustment parameter, and the fourth constraint is as follows:

    (11)

    Step 212, according to the first expression, the second expression, the third constraint and the fourth constraint are fitted to the coupling segment.

    By combining the first expression, the second expression, the third constraint and the fourth constraint, the values of the eight fitted parameters A1, B1, C1, D1, A2, B2, C2, and D2 can be obtained. Thereinto:

    (12)

    Step 213: Determine the first target connection segment according to the values of the eight fitting parameters.

    Substituting these eight values into equation (5) yields the first target connection segment.

    In one possible embodiment, the first length adjustment parameter is set for the first direction vector, and the second length adjustment parameter is set for the second direction vector, comprising:

    According to the radius of curvature of the desired first target connection segment, the value of the first length adjustment parameter of the first direction vector and the value of the second length adjustment parameter of the second direction vector are set.

    In an embodiment of the present invention, after a plurality of tests, the results show that the first length adjustment parameter and the second length adjustment parameter will have an impact on the curvature of the first coupling segment.

    FIG 4 (a) is a schematic diagram of the effect of the length of an endpoint direction vector on curve fitting provided by an embodiment of the present invention. FIG 4(b) is a schematic diagram of the effect of the length of an endpoint direction vector on curve fitting provided for an embodiment of the present invention.

    As shown in Fig. 4(a) and Fig. 4(b), when the first adjustment vector at point A is V4 and the second adjustment vector at point B is V2, the first target connection segment is curve L4; When the first adjustment vector at point A is V1 and the second adjustment vector at point B is also V2, the first target connection segment is curve L3, where V4 and V1 are parallel in the direction. When the length of V4 is greater than the length of V1, it can be seen from Figure 4(a) that curve L4 is more convex at endpoint A than curve L3; When the length of V4 is less than the length of V1, it can be seen from Figure 4(b) that curve L3 is more convex at endpoint A than curve L4. It follows that the curvature of the curve of the first target junction is proportional to the length of the first length adjustment parameter corresponding to the start endpoint. Through similar experiments, the influence of the second length adjustment parameter corresponding to the termination node on the curvature of the curve of the first target coupling section can also be obtained.

    Therefore, as long as the appropriate first length adjustment parameters and second length adjustment parameters are calculated according to the feature extraction and solution of the fitted scene, the fitting curve with suitable curvature can be generated, so the linear fitting method with length adjustment parameters has stronger adaptability and generalization ability for multiple scenes.

    Step 214, using the first target connection segment to connect the first line segment point cluster and the second line segment point cluster.

    In the embodiment of the present invention, step 214 may refer to step 105, which is not repeated herein.

    In summary, in the embodiment of the present invention, in the scenario of linear fitting between two points of endpoint coordinates and direction constraints, the comparison of the direction vector composed of two points and the direction vector of the two endpoints themselves determines whether the two points are straight lines or curves or abnormal exits, which provides a reference for the subsequent selection of the fitting model.

    Moreover, on the basis of the curve fitting model, the constraints of the endpoint coordinates and direction vector are added, so that the curve fitting connection between the two points is smoother.

    In addition, on the basis of the curve fitting model, a curve fitting method with length adjustment parameters based on endpoint and direction constraints is proposed, which enhances the adaptability and generalization ability of the scheme to multiple scenarios by increasing the length adjustment parameters.

    FIG 5 is a step flow chart of a linear fitting method for the third point cloud data provided by an embodiment of the present invention. The method can include the following steps:

    Step 301: Obtain the endpoint data of the first line segment point cluster to be connected and the start data of the second line segment point cluster, and obtain the first point data and the second point data.

    In the embodiment of the present invention, step 301 may refer to step 101, which is not repeated herein.

    Step 302, respectively, obtain the first point data, the second point data, the first point data and the second point data of the wiring direction vector, respectively, to obtain the first direction vector, the second direction vector and the third party vector; The first direction vector, the second direction vector, and the third direction vector are all unit vectors.

    In the embodiment of the present invention, step 302 may refer to step 202, which will not be repeated herein.

    Step 303, if the first direction vector, the second direction vector, and the third party vector are all equal, the connection segment is determined to be a straight line.

    Since the first direction vector, the second direction vector, and the third party vector are all unit vectors, all only need to determine whether the three are equal to determine whether the three are on the same straight line, thereby determining whether the connection segment is a curve or a straight line.

    If the three direction vectors are equal, it means that the three direction vectors are in a straight line, and the connection segment is a straight line.

    Step 304, if the connection segment is a straight line, the linear equation containing three parameters is determined as a straight line fitting model.

    When it is determined that the connection segment between the start point and the end point is a straight line, select the straight line equation as the straight line fitting model, and the straight line fitting model is as follows:

    (13)

    Among them, E, F, and G are the three fitting parameters.

    Step 305, the linear fitting model is used to fit the connection segment, and the second target connection segment is obtained.

    By fitting the straight line by fitting the coordinate values of the first point data and the second point data on the straight line fitting model, the values of the three fitting parameters can be obtained, and the values of the three fitted parameters are substituted into the equation (13) to obtain the second target connection segment.

    In one possible embodiment, the fitting of the coupling segment using the straight line fitting model, comprising steps 3051-3054:

    Step 3051, when determining that the abscissa of the first point data and the second point data is the same, the line fits the third expression of the model.

    Substituting the first data A(x1,y1) and the second data B(x2,y2) into equation (13) yields:

    (14)

    Subtract the two equations in equation (14) to yield:

    (15)

    When the abscissa of the first point data is the same as the second point data, the third expression is obtained from equation (15) as follows:

    (16)

    Step 3052, when determining that the ordinate of the first point data and the second point data are the same, the line fits the fourth expression of the model.

    When the abscissa of the first point data is the same as the second point data, the fourth expression is obtained from equation (15) as follows:

    (17)

    Step 3053, when determining that the abscissa and ordinate of the first point data and the second point data are different, the line fits the fifth expression of the model.

    When determining that the abscissa and ordinate of the first point data and the second point data are different, and the fifth expression is obtained from equation (15) as follows:

    (18)

    Step 3054, according to the third expression, the fourth expression and the fifth expression, the coupling segment is fitted.

    By combining the third expression, the fourth expression, and the fifth expression, the values of the three fitted parameters E, F, and G can be obtained.

    Substituting these three values into equation (13) yields a second target coupling segment.

    In summary, in an embodiment of the present invention, the first direction vector, the second direction vector, and the third party direction vector are used to determine whether the connection segment is a straight line or a curve, and the judgment method is simple and accurate, which is convenient to use different fitting methods to fit the connection segment later. In the case of determining that the connection segment is a straight line, the linear equation including three fitting parameters is used to fit the fitting efficiency and fitting accuracy.

    FIG 6 is a structural block diagram of a linear fitting device for point cloud data provided by an embodiment of the present invention. The device 400 comprises:

    Point data acquisition module 401, for obtaining the end point data of the first line segment point cluster to be connected and the start data of the second line segment point cluster, to obtain the first point data and the second point data;

    The direction vector acquisition module 402 is configured to obtain the direction vector of the first line segment point cluster at the first point data, the direction vector of the second line segment point cluster at the second point data, the direction vector of the target vector composed of the first point data and the second point data, respectively, to obtain the first direction vector, the second direction vector and the third party vector;

    the straightness determination module 403 is configured to determine the straightness of the connection segment between the first segment point cluster and the second line segment point cluster according to the first direction vector, the second direction vector, and the third party vector vector;

    The curve fitting module 404 is configured for fitting the coupling segment by using a parametric curve fitting model if the connecting segment is a curve, and the first direction vector and the second direction vector are used as the fitting constraints to obtain the first target connection segment;

    The connection module 405 is configured to connect the first segment point cluster and the second segment point cluster using the first target connection segment.

    Those skilled in the art can clearly understand that for the convenience and conciseness of the description, the specific working process of the system, device and unit described above may refer to the corresponding process in the embodiment of the foregoing method, and will not be repeated herein.

    In an embodiment of the present invention, the first direction vector, the second direction vector, and the third party vector are all unit vectors.

    In an embodiment of the present invention, the straightness determination module is specifically used for:

    If the first direction vector, the second direction vector, and the third direction vector are all equal, the connection segment is determined to be a straight line;

    If any two vectors in the first direction vector, the second direction vector, and the third direction vector are not equal, the connection segment is determined to be a curve.

    In an embodiment of the present invention, the curve fitting module is specifically used for:

    The parametric cubic polynomial is determined as a curve fitting model, the independent variable of the curve fitting model is the distance between the first point data and any point on the connecting segment, and the curve fitting model includes eight fitting parameters;

    determine the first expression corresponding to the curve-fitting model at the first point data, and at the second point data, the second expression corresponding to the curve-fitting model;

    The partial derivative of the curve-fitting model according to the first point data is the first direction vector, and the partial derivative of the curve fitting model at the second point data is the second direction vector, and the first constraint and the second constraint are obtained;

    determine the values of the eight fitted parameters according to the first expression, the second expression, the first constraint and the second constraint;

    The first target connection segment is determined according to the values of the eight fitting parameters.

    In an embodiment of the present invention, the apparatus further comprises:

    The linear fitting model determination module is used to determine the linear equation containing three parameters as a linear fitting model if the connecting segment is a straight line;

    The linear fitting module is used to fit the connecting segment using the linear fitting model to obtain the second target connecting segment.

    In the embodiment of the present invention, the straight line fitting module is specifically used for:

    When determining that the abscissa of the first point data and the second point data is the same, the third expression of the straight line fitting model;

    When determining that the ordinate of the first point data and the second point data are the same, the fourth expression of the straight line fitting the model;

    When determining that the abscissa and ordinate of the first point data and the second point data are different, the fifth expression of the straight line fitting model;

    According to the third expression, the fourth expression, and the fifth expression, the coupling segment is fitted.

    In an embodiment of the present invention, the curve fitting module is specifically used for:

    The parametric cubic polynomial is determined as a curve fitting model, the independent variable of the curve fitting model is the distance between the first point data and any point on the connecting segment, and the curve fitting model includes eight fitting parameters;

    set the first length adjustment parameter for the first direction vector and the second length adjustment parameter for the second direction vector;

    According to the partial derivative of the curve fitting model at the first point data, the product of the first direction vector and the first length adjustment parameter is obtained;

    According to the partial derivative of the curve fitting model at the second point data, the product of the second direction vector and the second length adjustment parameter is obtained;

    determine the values of the eight fitted parameters according to the first expression, the second expression, the third constraint and the fourth constraint;

    The first target connection segment is determined according to the values of the eight fitting parameters.

    In an embodiment of the present invention, the curve fitting module is further used for:

    According to the radius of curvature of the desired first target connection segment, the value of the first length adjustment parameter of the first direction vector and the value of the second length adjustment parameter of the second direction vector are set.

    In yet another embodiment provided by the present invention, the device also provides a device comprising a processor and a memory, the memory type stores at least one instruction, at least one program, code set or instruction set, said at least one instruction, at least one piece of the program, the code set or instruction set is loaded and executed by the processor to achieve a linear fitting method of point cloud data described in the embodiment of the present invention.

    In yet another embodiment provided by the present invention, a computer-readable storage medium is also provided in which at least one instruction, at least one program, code set or instruction set is stored, and at least one instruction, at least one program, said code set or instruction set is loaded and executed by the processor to achieve a linear fitting method of point cloud data described in embodiments of the present invention.

    In the above embodiments, may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing the computer program instructions on the computer, the process or function described in accordance with the embodiment of the present invention is produced in whole or in part. The computer may be a general-purpose computer, a special computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) to another website site, computer, server or data center. The computer-readable storage medium may be any usable medium that the computer can access or a server, data center and other data storage device containing one or more available media integration. The available media may be magnetic media, (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid state disk (SSD)) and the like.

    It is important to note that in this article, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another, without necessarily requiring or implying any such actual relationship or order between these entities or operations. Further, the terms "comprise", "comprise" or any other variation thereof are intended to cover non-exclusive inclusions such that a process, method, article or apparatus comprising a range of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such processes, methods, articles or equipment. Without further limitation, the elements qualified by the statement "including a..." do not exclude the existence of other identical elements in the process, method, article or apparatus comprising said elements.

    Each embodiment in this specification is described in a relevant manner, and the same similar parts between each embodiment can refer to each other, and each embodiment focuses on the difference from other embodiments. In particular, for system embodiments, because it is basically similar to the method embodiment, the description is relatively simple, and the relevant points can be referred to the partial description of the method embodiment.

    The foregoing is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modification, equivalent substitution, improvement, etc. made within the spirit and principles of the present invention is included in the scope of protection of the present invention.

    展开 >
    说明书附图
    >
    交易服务流程
    >

    挑选中意的板块

    ----

    客服确认选择专利的交易信息和价格并支付相应款项

    办理转让材料

    ----

    协助双方准备相应的材料

    签订协议

    ----

    协助卖家签订协议

    办理备案手续

    ----

    买卖双方达成一致后

    交易完成

    ----

    交易完成可投入使用

    过户资料 & 安全保障 & 承诺信息
    >

    过户资料

    买卖双方需提供的资料
    公司 个人
    买家 企业营业执照
    企业组织机构代码证
    身份证
    卖家 企业营业执照
    专利证书原件
    身份证
    专利证书原件
    网站提供 过户后您将获得
    专利代理委托书
    专利权转让协议
    办理文件副本请求书
    发明人变更声明
    专利证书
    手续合格通知书
    专利登记薄副本

    安全保障

    承诺信息

    我方拟转让所持标的项目,通过中国汽车知识产权应用促进中心公开披露项目信息和组织交易活动,依照公开、公平、公正和诚信的原则作如下承诺:

    1、本次项目交易是我方真实意思表示,项目标的权属清晰,除已披露的事项外,我方对该项目拥有完全的处置权且不存在法律法规禁止或限制交易的情形;
    2、本项目标的中所涉及的处置行为已履行了相应程序,经过有效的内部决策,并获得相应批准;交易标的涉及共有或交易标的上设置有他项权利,已获得相关权利 人同意的有效文件。
    3、我方所提交的信息发布申请及相关材料真实、完整、准确、合法、有效,不存在虚假记载、误导性陈述或重大遗漏;我方同意平台按上述材料内容发布披露信息, 并对披露内容和上述的真实性、完整性、准确性、合法性、有效性承担法律责任;
    4、我方在交易过程中自愿遵守有关法律法规和平台相关交易规则及规定,恪守信息发布公告约定,按照相关要求履行我方义务;
    5、我方已认真考虑本次项目交易行为可能导致的企业经营、行业、市场、政策以及其他不可预计的各项风险因素,愿意自行承担可能存在的一切交易风险;
    6、我方在平台所组织交易期间将不通过其他渠道对标的项目进行交易;
    7、我方将按照平台收费办法及相关交易文件的约定及时、足额支付相关费用,不因与受让方争议或合同解除、终止等原因拒绝、拖延、减少交纳或主张退还相关费用。