Method and device for extracting sub-pixels in centers of light bars

文档序号:1447558 发布日期:2020-02-18 浏览:25次 中文

阅读说明:本技术 一种光条中心亚像素的提取方法及装置 (Method and device for extracting sub-pixels in centers of light bars ) 是由 罗林 于 2019-11-04 设计创作,主要内容包括:本申请实施例提供一种光条中心亚像素的提取方法及装置,涉及图像处理领域,该方法包括:对获取到的光条图像进行骨架提取,得到包括多个骨架点的骨架图像;根据多个骨架点建立顺序链表;遍历计算顺序链表中多个骨架点的法线方向,并遍历计算顺序链表中多个骨架点的骨架曲率;根据法线方向和骨架曲率进行计算,得到光条中心亚像素信息。实施这种实施方式,能够实现对光条任意方向亚像素中心进行提取,从而能够提升了激光线扫三维重建精度和重建的效率。(The embodiment of the application provides a method and a device for extracting sub-pixels in the center of a light strip, and relates to the field of image processing, wherein the method comprises the following steps: carrying out skeleton extraction on the acquired light bar image to obtain a skeleton image comprising a plurality of skeleton points; establishing a sequential linked list according to a plurality of skeleton points; traversing normal directions of a plurality of skeleton points in the calculation sequence linked list, and traversing skeleton curvatures of the plurality of skeleton points in the calculation sequence linked list; and calculating according to the normal direction and the curvature of the skeleton to obtain the sub-pixel information of the center of the light strip. By implementing the implementation mode, the extraction of the sub-pixel center of the optical strip in any direction can be realized, so that the laser line scanning three-dimensional reconstruction precision and the reconstruction efficiency can be improved.)

1. A method for extracting sub-pixels in the center of a light bar is characterized by comprising the following steps:

carrying out skeleton extraction on the acquired light bar image to obtain a skeleton image comprising a plurality of skeleton points;

establishing a sequential linked list according to the plurality of skeleton points;

traversing and calculating normal directions of the plurality of skeleton points in the sequence linked list, and traversing and calculating skeleton curvatures of the plurality of skeleton points in the sequence linked list;

and calculating according to the normal direction and the curvature of the skeleton to obtain light bar center sub-pixel information.

2. The method according to claim 1, wherein before the step of performing skeleton extraction on the acquired light bar image to obtain a skeleton image including a plurality of skeleton points, the method further comprises:

acquiring an initial image;

and carrying out light bar region segmentation on the initial image to obtain a light bar image.

3. The method of claim 1, wherein the step of creating the sequential linked list according to the plurality of skeleton points comprises:

establishing an initial linked list;

acquiring a first skeleton point included by the plurality of skeleton points, and inserting the first skeleton point into the initial linked list as a linked list head to obtain a first intermediate linked list;

acquiring second skeleton points included by the plurality of skeleton points according to a preset optical strip scanning sequence, and inserting the second skeleton points into the first intermediate linked list as linked list tails to obtain a second intermediate linked list;

and obtaining a third skeleton point included by the plurality of skeleton points according to the scanning sequence of the light bars, and inserting the third skeleton point into the head or the tail of the second intermediate linked list according to the distance between the third skeleton point and the first skeleton point and the second skeleton point to obtain the sequential linked list.

4. The method of claim 1, wherein the step of calculating the normal directions of the skeleton points in the sequential linked list comprises:

obtaining a plurality of corresponding groups of fitting points in a first preset radius by taking each skeleton point in the plurality of skeleton points as a central point;

fitting and calculating the fit points in the multiple groups of first preset radii according to a least square method to obtain multiple fit straight lines;

and determining a plurality of normal directions corresponding to the plurality of fitted straight lines as the normal directions of the plurality of skeleton points.

5. The method of claim 1, wherein the step of calculating the skeleton curvature of the plurality of skeleton points in the sequential linked list comprises:

acquiring a plurality of groups of corresponding second preset-radius inner double end points by taking each skeleton point in the plurality of skeleton points as a central point, and calculating a plurality of distances between the plurality of groups of second preset-radius inner double end points to obtain a chord length set;

calculating a plurality of distances from the central point to a straight line formed by connecting double end points in the plurality of groups of second preset radiuses to obtain an arch height set;

and traversing and calculating the skeleton curvatures of the skeleton points in the sequence linked list according to the chord length set and the arch height set.

6. The method for extracting sub-pixels in the center of a light bar according to claim 5, wherein the data included in the chord length set, the data included in the arch height set, and the skeleton curvatures of the plurality of skeleton points are in one-to-one correspondence, and wherein a formula for calculating the skeleton curvature of a single skeleton point in the skeleton curvatures of the plurality of skeleton points comprises:

R=H/2+L2/(8H);

ρ=1/R;

wherein R is a curvature radius;

l is a chord length;

h is the arch height;

ρ is the skeleton curvature.

7. The method according to claim 1, wherein the step of obtaining the light bar center sub-pixel information by performing the calculation according to the normal direction and the skeleton curvature comprises:

calculating according to a preset maximum tangent width value, a preset minimum tangent width value and the curvature of the framework to obtain a tangent length value of the framework;

determining to obtain a sub-pixel region according to the normal direction, a preset normal length value and the length value of the skeleton tangent line;

and extracting information in the sub-pixel area to obtain light bar center sub-pixel information.

8. The method according to claim 7, wherein the step of calculating the skeleton tangent length value according to a preset maximum tangent width value, a preset minimum tangent width value and the skeleton curvature comprises:

acquiring a preset minimum curvature and a preset maximum curvature;

calculating according to a preset maximum tangent width value, a preset minimum tangent width value, the minimum curvature, the maximum curvature, the skeleton curvature and a preset skeleton tangent length calculation formula to obtain a skeleton tangent length value; wherein the content of the first and second substances,

the skeleton tangent length calculation formula comprises:

Wt=(ρ-ρmin)*(Wtmax-Wtmin)/(ρmaxmin)+Wtmin

wherein ρ is the curvature of the skeleton;

ρmaxis the maximum curvature;

ρminis the minimum curvature;

Wtmaxis the maximum tangent width value;

Wtminis the minimum tangent width value;

wt is the skeleton tangent length value.

9. An extraction device for sub-pixels in the center of a light bar is characterized by comprising:

the extraction unit is used for carrying out skeleton extraction on the acquired light bar image to obtain a skeleton image comprising a plurality of skeleton points;

the table building unit is used for building a sequential linked list according to the plurality of skeleton points;

the first calculation unit is used for calculating the normal directions and the skeleton curvatures of the skeleton points in the sequence linked list in a traversing manner;

and the second calculation unit is used for calculating according to the normal direction and the skeleton curvature to obtain the light bar center sub-pixel information.

10. An electronic device, comprising a memory for storing a computer program and a processor for executing the computer program to cause the electronic device to perform the method of extracting light bar center sub-pixels according to any one of claims 1 to 8.

11. A readable storage medium having stored thereon computer program instructions which, when read and executed by a processor, perform the method for extracting sub-pixels in the center of a light bar according to any one of claims 1 to 8.

Technical Field

The application relates to the field of image processing, in particular to a method and a device for extracting sub-pixels in the center of a light bar.

Background

At present, in the aspect of laser line scanning three-dimensional reconstruction, the extraction of the central line of a laser bar in an image is very important, and the reconstruction precision is directly influenced. In the conventional method, it is often assumed that the laser stripe is in a horizontal or vertical direction in the image, and then the centerline extraction only needs to search along a row or column direction. However, in practice, it is found that when the curvature of the surface of the object to be measured changes greatly, more than one central point of the light bar may exist in the same row or column, and it is difficult for the conventional method to retain all the central points, so that the central line of the laser bar is extracted and lost, and the laser line scanning three-dimensional reconstruction accuracy is reduced.

Disclosure of Invention

An object of the embodiments of the present application is to provide a method and an apparatus for extracting sub-pixels in the center of a light bar, so as to extract the center of the sub-pixels in any direction of the light bar, thereby improving the laser line scanning three-dimensional reconstruction accuracy and the reconstruction efficiency.

A first aspect of an embodiment of the present application provides a method for extracting sub-pixels in a center of a light bar, where the method includes:

carrying out skeleton extraction on the acquired light bar image to obtain a skeleton image comprising a plurality of skeleton points;

establishing a sequential linked list according to the plurality of skeleton points;

traversing and calculating normal directions of the plurality of skeleton points in the sequence linked list, and traversing and calculating skeleton curvatures of the plurality of skeleton points in the sequence linked list;

and calculating according to the normal direction and the curvature of the skeleton to obtain light bar center sub-pixel information.

In the implementation process, the method can preferentially acquire the light bar image and perform skeleton extraction on the light bar image so as to obtain a skeleton image comprising a plurality of skeleton points; then, sequentially establishing a sequential linked list according to a plurality of skeleton points included in the skeleton image so as to store the skeleton points through the sequential linked list; secondly, calculating the normal directions and the skeleton curvatures of a plurality of skeleton points in the sequence linked list, so that the calculated normal directions and skeleton curvatures can be used for calculating two-dimensional image information of the sub-pixel information in the center of the light strip, and the sub-pixel information in the center of the light strip is obtained; the sub-pixel information in the center of the light bar can be coordinate information in the image. Therefore, by implementing the implementation mode, the method can assist the calculation of the light bar center sub-pixel information through the skeleton extraction and the sequence linked list, so that the light bar center sub-pixel information can be extracted more quickly and accurately, and the laser line scanning three-dimensional reconstruction precision and the reconstruction efficiency are further improved.

Further, before the step of performing skeleton extraction on the acquired light bar image to obtain a skeleton image including a plurality of skeleton points, the method further includes:

acquiring an initial image;

and carrying out light bar region segmentation on the initial image to obtain a light bar image.

In the implementation process, the method can also acquire initial image information in advance, and perform preliminary processing on the image information to obtain the information used for extracting the sub-pixels in the centers of the light bars. By implementing the embodiment, the input image can be acquired and is used as the initial image to carry out the light bar area segmentation, so that the acquisition quality of the light bar image is improved; meanwhile, the brightness of the light bars is much higher than that of other areas, and a binarization method can be adopted for segmentation, so that areas which are obviously not light bars can be eliminated, an image only containing the light bar areas is obtained, and the acquisition quality of the light bar image is further improved.

Further, the step of establishing a sequential linked list according to the plurality of skeleton points includes:

establishing an initial linked list;

acquiring a first skeleton point included by the plurality of skeleton points, and inserting the first skeleton point into the initial linked list as a linked list head to obtain a first intermediate linked list;

acquiring second skeleton points included by the plurality of skeleton points according to a preset optical strip scanning sequence, and inserting the second skeleton points into the first intermediate linked list as linked list tails to obtain a second intermediate linked list;

and obtaining a third skeleton point included by the plurality of skeleton points according to the scanning sequence of the light bars, and inserting the third skeleton point into the head or the tail of the second intermediate linked list according to the distance between the third skeleton point and the first skeleton point and the second skeleton point to obtain the sequential linked list.

In the implementation process, the method provides a process for establishing the sequence linked list, and in the process, the sequence linked list is sorted and stored according to a certain sequence along with the increase of the skeleton points, so that a storage framework with a fixed sequence is obtained. Therefore, by implementing the implementation mode, the method can more reasonably store the skeleton points, and greatly facilitates the subsequent traversal calculation and corresponding calling process, so that the extraction efficiency of the sub-pixels in the center of the light strip can be improved, and the laser line scanning three-dimensional reconstruction efficiency can be further improved.

Further, the step of calculating the normal directions of the plurality of skeleton points in the sequential linked list by traversing includes:

obtaining a plurality of corresponding groups of fitting points in a first preset radius by taking each skeleton point in the plurality of skeleton points as a central point;

fitting and calculating the fit points in the multiple groups of first preset radii according to a least square method to obtain multiple fit straight lines;

and determining a plurality of normal directions corresponding to the plurality of fitted straight lines as the normal directions of the plurality of skeleton points.

In the implementation process, the method can perform auxiliary calculation on the skeleton points according to a smaller preset radius, and meanwhile, the corresponding fitted straight line can be obtained more efficiently by using a least square method, so that the normal directions of a plurality of skeleton points can be determined. Therefore, by the implementation of the implementation mode, the normal direction of each skeleton point can be acquired more efficiently, and the extraction efficiency of the sub-pixels in the centers of the light bars is improved.

Further, the step of calculating the skeleton curvatures of the skeleton points in the sequential linked list in a traversal manner includes:

acquiring a plurality of groups of corresponding second preset-radius inner double end points by taking each skeleton point in the plurality of skeleton points as a central point, and calculating a plurality of distances between the plurality of groups of second preset-radius inner double end points to obtain a chord length set;

calculating a plurality of distances from the central point to a straight line formed by connecting double end points in the plurality of groups of second preset radiuses to obtain an arch height set;

and traversing and calculating the skeleton curvatures of the skeleton points in the sequence linked list according to the chord length set and the arch height set.

In the implementation process, the method can determine two end points by taking the skeleton point as a center and the second preset radius as a radius, so as to determine the distance between the two end points as the chord length in curvature calculation; meanwhile, calculating the distance from the skeleton point to a straight line formed by two end points, and determining the distance as the arch height; on the basis of the chord length and the arch height, the method can further calculate the curvature radius and the curvature. Therefore, by implementing the implementation mode, the calculation of the curvature can be greatly simplified, and the extraction efficiency of the sub-pixels in the center of the light bar can be further improved by improving the calculation efficiency of the curvature.

Further, the data included in the chord length set, the data included in the arch height set, and the skeleton curvatures of the plurality of skeleton points are in one-to-one correspondence, wherein a calculation formula of the skeleton curvature of a single skeleton point in the skeleton curvatures of the plurality of skeleton points includes:

R=H/2+L2/(8H);

ρ=1/R;

wherein R is a curvature radius;

l is a chord length;

h is the arch height;

ρ is the skeleton curvature.

In the implementation process, the method can calculate the curvature of the skeleton according to the formula. Therefore, by implementing the implementation mode, the required skeleton curvature can be calculated through a simpler calculation mode and a calculation formula, so that the complexity is reduced, and the calculation efficiency and the light bar center sub-pixel extraction efficiency are effectively improved.

Further, the step of calculating according to the normal direction and the curvature of the skeleton to obtain the sub-pixel information of the center of the light bar comprises:

calculating according to a preset maximum tangent width value, a preset minimum tangent width value and the curvature of the framework to obtain a tangent length value of the framework;

determining to obtain a sub-pixel region according to the normal direction, a preset normal length value and the length value of the skeleton tangent line;

and extracting information in the sub-pixel area to obtain light bar center sub-pixel information.

In the implementation process, the method can calculate the length of the skeleton tangent line according to preset parameters, determine the position of the sub-pixel region according to the normal direction, and then determine and obtain the accurate sub-pixel region according to the preset normal length value and the length value of the skeleton tangent line, so that the sub-pixel information in the center of the light bar can be accurately extracted from the accurate sub-pixel region. Therefore, by the implementation of the implementation mode, the extraction precision of the sub-pixel information in the center of the light strip can be improved, and the laser line scanning three-dimensional reconstruction precision can be improved.

Further, the step of calculating according to a preset maximum tangent width value, a preset minimum tangent width value and the curvature of the framework to obtain a tangent length value of the framework comprises:

acquiring a preset minimum curvature and a preset maximum curvature;

calculating according to a preset maximum tangent width value, a preset minimum tangent width value, the minimum curvature, the maximum curvature, the skeleton curvature and a preset skeleton tangent length calculation formula to obtain a skeleton tangent length value; wherein the content of the first and second substances,

the skeleton tangent length calculation formula comprises:

Wt=(ρ-ρmin)*(Wtmax-Wtmin)/(ρmaxmin)+Wtmin

wherein ρ is the curvature of the skeleton;

ρmaxis the maximum curvature;

ρminis the minimum curvature;

Wtmaxis the maximum tangent width value;

Wtminis the minimum tangent width value;

wt is the skeleton tangent length value.

In the implementation process, the method can calculate the accurate length value of the skeleton tangent line through the formula. Therefore, by implementing the implementation mode, the accurate calculation of the length value of the tangent line of the framework can be realized through simple formula calculation and accurate parameter setting, so that the calculation efficiency and the calculation precision of the length value of the tangent line of the framework are improved.

A second aspect of the embodiments of the present application provides an extraction device for a light stripe center subpixel, including:

the extraction unit is used for carrying out skeleton extraction on the acquired light bar image to obtain a skeleton image comprising a plurality of skeleton points;

the table building unit is used for building a sequential linked list according to the plurality of skeleton points;

the first calculation unit is used for calculating the normal directions and the skeleton curvatures of the skeleton points in the sequence linked list in a traversing manner;

and the second calculation unit is used for calculating according to the normal direction and the skeleton curvature to obtain the light bar center sub-pixel information.

In the implementation process, the extraction device for the sub-pixels in the center of the light strip can perform corresponding processing calculation sequentially through the extraction unit, the table building unit, the first calculation unit and the second calculation unit, so that an accurate and effective calculation process is determined, and the device can acquire the sub-pixel information in the center of the light strip more quickly and accurately. Therefore, by implementing the embodiment, the device can accurately extract the center of the sub-pixel of the optical strip in any direction through the combined work of a plurality of units, thereby further improving the laser line scanning three-dimensional reconstruction precision and the reconstruction efficiency.

A third aspect of embodiments of the present application provides an electronic device, including a memory for storing a computer program and a processor for executing the computer program to cause the electronic device to perform the method for extracting a sub-pixel in a center of a light bar according to any one of the first aspect of embodiments of the present application.

A fourth aspect of the present embodiment provides a computer-readable storage medium, which stores computer program instructions, which when read and executed by a processor, perform the method for extracting sub-pixels in the center of a light bar according to any one of the first aspect of the present embodiment.

Drawings

In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.

Fig. 1 is a schematic flowchart illustrating a method for extracting sub-pixels in the center of a light bar according to an embodiment of the present disclosure;

fig. 2 is a schematic flowchart of another method for extracting sub-pixels from the center of a light bar according to an embodiment of the present disclosure;

fig. 3 is a schematic partial detailed flowchart of a method for extracting sub-pixels in the center of a light bar according to an embodiment of the present disclosure;

fig. 4 is a schematic structural diagram of an extracting apparatus for sub-pixels in the center of a light bar according to an embodiment of the present disclosure;

fig. 5 is a schematic structural diagram of another light bar center sub-pixel extraction device according to an embodiment of the present disclosure.

Detailed Description

The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.

It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.

19页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:焊接方法、设备和存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!