Method and device for detecting circle, electronic equipment and storage medium

By acquiring input point cloud data, calculating the initial radius, and performing random sampling, the radius voting range and the maximum voting position are determined, thus solving the problem of low accuracy in circular fitting of single-layer point clouds and achieving higher accuracy in circle detection.

CN121904129APending Publication Date: 2026-04-21FAIR INNOVATION (SUZHOU) ROBOTIC SYSTEM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FAIR INNOVATION (SUZHOU) ROBOTIC SYSTEM CO LTD
Filing Date
2026-01-16
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing technologies have poor accuracy in circular fitting when detecting single-layer point clouds, which leads to a decrease in the accuracy of calculating the normal of the projection points.

Method used

By acquiring input point cloud data, calculating the initial radius, repeatedly performing random sampling operations, determining the radius voting range, generating multiple first radii, obtaining the maximum voting position and voting value, and calculating the second radius, a circle can be detected.

Benefits of technology

It improves the accuracy of circular fitting for single-layer point clouds and enhances the precision of circle detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121904129A_ABST
    Figure CN121904129A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a circle detection method and device, electronic equipment and a storage medium, and relates to the field of weld joint processing, and the method comprises the steps: obtaining input point cloud data, and calculating an initial radius based on the input point cloud data; n times of random sampling operation are repeatedly executed, two different sampling points are selected from the input point cloud data each time, and a radius voting range is determined based on each group of sampling points; performing discrete sampling according to a preset step length in the radius voting range, generating a plurality of first radiuses, generating a corresponding voting position according to each first radius, obtaining a maximum voting position and a maximum voting value corresponding to the maximum voting position from the voting positions, calculating a second radius based on the maximum voting position, and obtaining a voting value corresponding to the maximum voting position; and detecting the circle from the input point cloud data based on the maximum voting position and the second radius, so that the accuracy of circle fitting of the single-layer point cloud can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of weld seam treatment, and more specifically, to a method, apparatus, electronic device, and storage medium for detecting circles. Background Technology

[0002] Existing circle detection algorithms require projection points to originate from points on the cylindrical surface, meaning the cylindrical surface has a certain height. This allows the projection points to be arranged in a dense manner. When the cylindrical surface has a certain height, a series of points on the cylindrical surface that are parallel to the axis will form a single point or points that are very close together during projection. This results in a certain degree of redundancy in the projection points, and the calculation of the normal of the projection points is also more accurate.

[0003] However, when the height of the cylindrical surface becomes 0, that is, when there is only a single-layer point cloud, the redundancy of the projected points will disappear, and the distribution of the projected points will be relatively sparse. At this time, the accuracy of calculating the normal of the projected points will decrease, and thus the accuracy of the circle detection method that relies on the normal for voting will decrease. Summary of the Invention

[0004] The purpose of this invention is to provide a method, apparatus, electronic device, and storage medium for detecting circles, which can improve the accuracy of circular fitting of single-layer point clouds.

[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows: In a first aspect, embodiments of this application provide a method for detecting a circle, the method comprising: Acquire input point cloud data, wherein the input point cloud data is a single-layer point cloud; Calculate the initial radius based on the input point cloud data; Repeat the random sampling operation N times, selecting two different sampling points from the input point cloud data each time; Based on each set of sampling points, determine the radius voting range; Within the radius voting range, discrete sampling is performed at a preset step size to generate multiple first radii; Generate a corresponding voting position based on each of the first radii; Obtain the maximum voting position and the maximum voting value corresponding to the maximum voting position from each of the voting positions; When the maximum vote value is greater than the preset vote value, a second radius is calculated based on the maximum vote position; Based on the maximum voting position and the second radius, a circle is detected from the input point cloud data.

[0006] In an optional implementation, the step of calculating the initial radius based on the input point cloud data includes: Determine the centroid in the input point cloud data; The centroid of the input point cloud data is removed to obtain the first point cloud data; Calculate the length of each point in the first point cloud data; Calculate the average of the given lengths as the initial radius.

[0007] In an optional implementation, each set of sampling points includes a first sampling point and a second sampling point, and the step of determining the radius voting range based on each set of sampling points includes: Determine the midpoint between the first sampling point and the second sampling point; Calculate the direction vector perpendicular to the line connecting the first sampling point and the second sampling point; Calculate the length of the midpoint; The radius voting range is calculated based on the length of the midpoint, the direction vector, and the initial radius.

[0008] In an optional implementation, the step of generating a corresponding voting position based on each of the first radii includes: The voting position is determined based on the midpoint, the first radius, and the direction vector.

[0009] In an optional implementation, the step of obtaining the maximum voting position and the maximum voting value corresponding to the maximum voting position from each of the voting positions includes: Determine the vote value for each voting position; Obtain the maximum vote value from each quantity; The voting position corresponding to the maximum voting value is determined as the maximum voting position.

[0010] In an optional implementation, the step of calculating the second radius based on the maximum voting position includes: Calculate the set of distances between each point in the input point cloud data and the center of the circle corresponding to the position with the largest vote; A histogram is constructed based on the distance set, wherein the histogram contains multiple histogram subgraphs, and the histogram subgraphs indicate the number of distances. Use variable i to traverse the distance set and determine the distance corresponding to variable i; The distance corresponding to variable i is quantized to obtain a quantized value; The histogram is updated based on the quantization value to obtain the updated histogram; Obtain the maximum histogram subgraph from the updated histogram; Obtain the first and second histograms adjacent to the maximum histogram from the updated histogram; The second radius is calculated based on the maximum histogram, the first histogram, and the second histogram.

[0011] In an optional implementation, the step of detecting a circle from the input point cloud data based on the maximum voting position and the second radius includes: Calculate the first distance between each point in the input point cloud data and the center of the circle corresponding to the maximum voting position; For each of the first distances, calculate the difference between the first distance and the second radius; When the absolute value of the difference is less than a preset threshold, the point is taken as a point on the circle; Determine the number of points on the circle; When the number is greater than or equal to a preset point threshold, the circle of the input point cloud data is obtained based on the points on each circle.

[0012] Secondly, embodiments of this application provide an apparatus for detecting a circle, the apparatus comprising: An acquisition module is used to acquire input point cloud data, wherein the input point cloud data is a single-layer point cloud; The determination module is used to calculate the initial radius based on the input point cloud data; The acquisition module is also used to repeatedly perform a random sampling operation N times, each time selecting two different sampling points from the input point cloud data; The determining module is also used to determine the radius voting range based on each set of sampling points; to perform discrete sampling within the radius voting range at a preset step size to generate multiple first radii; to generate corresponding voting positions on the vertical bisector based on each first radius; to obtain the maximum voting position and the maximum voting value corresponding to the maximum voting position from each of the voting positions; and to calculate the second radius based on the maximum voting position when the maximum voting value is greater than a preset voting value. A detection module is used to detect circles from the input point cloud data based on the maximum voting position and the second radius.

[0013] Thirdly, embodiments of this application provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method for detecting a circle.

[0014] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for detecting a circle.

[0015] This application has the following beneficial effects: This application improves the accuracy of circular fitting from a single-layer point cloud by acquiring input point cloud data, calculating an initial radius based on the input point cloud data, repeatedly performing random sampling operations N times, selecting two different sampling points from the input point cloud data each time, determining the radius voting range based on each set of sampling points, performing discrete sampling within the radius voting range at a preset step size to generate multiple first radii, generating corresponding voting positions based on each first radius, obtaining the maximum voting position and the maximum voting value corresponding to the maximum voting position from each voting position, calculating a second radius based on the maximum voting position, and detecting circles from the input point cloud data based on the maximum voting position and the second radius. Attached Figure Description

[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 A block diagram of an electronic device provided in an embodiment of the present invention; Figure 2 This is one of the flowcharts illustrating a method for detecting a circle according to an embodiment of the present invention; Figure 3 This is a second schematic flowchart of a method for detecting a circle provided in an embodiment of the present invention; Figure 4 The third schematic flowchart of a method for detecting a circle provided in an embodiment of the present invention; Figure 5 The fourth schematic flowchart of a method for detecting a circle provided in an embodiment of the present invention; Figure 6 The fifth schematic flowchart of a method for detecting a circle provided in an embodiment of the present invention; Figure 7 A schematic flowchart of a method for detecting a circle provided in an embodiment of the present invention is shown in Figure 6. Figure 8 This is the seventh flowchart illustrating a method for detecting a circle provided in an embodiment of the present invention. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0019] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0020] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0021] In the description of this invention, it should be noted that if terms such as "upper," "lower," "inner," or "outer" are used to indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship in which the product of this invention is usually placed, they are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention.

[0022] Furthermore, the terms "first" and "second" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.

[0023] In the description of this application, it should also be noted that, unless otherwise expressly specified and limited, the terms "set up," "install," "connect," and "link" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.

[0024] The inventors discovered through extensive research that the accuracy of circular fitting for single-layer point clouds is poor.

[0025] In view of the above-mentioned problems, this embodiment provides a method, apparatus, electronic device, and storage medium for detecting circles. It can acquire input point cloud data, calculate an initial radius based on the input point cloud data, repeatedly perform N random sampling operations, selecting two different sampling points from the input point cloud data each time, and determine a radius voting range based on each set of sampling points. Within the radius voting range, discrete sampling is performed at a preset step size to generate multiple first radii. Based on each first radius, a corresponding voting position is generated. The maximum voting position and the maximum voting value corresponding to the maximum voting position are obtained from each voting position. When the maximum voting value is greater than a preset voting value, a second radius is calculated based on the maximum voting position. Based on the maximum voting position and the second radius, a circle is detected from the input point cloud data. This can improve the accuracy of circular fitting from a single-layer point cloud. The solution provided in this embodiment is described in detail below.

[0026] This embodiment provides an electronic device capable of detecting circles. In one possible implementation, the electronic device can be a user terminal, such as, but not limited to, a server, smartphone, personal computer (PC), tablet computer, personal digital assistant (PDA), mobile internet device (MID), etc.

[0027] Please refer to Figure 1 , Figure 1 This is a schematic diagram of the structure of the electronic device 100 provided in the embodiments of this application. The electronic device 100 may further include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown. Figure 1 The components shown can be implemented using hardware, software, or a combination thereof.

[0028] The electronic device 100 includes a device 110 for detecting circles, a memory 120, and a processor 130.

[0029] The components of the memory 120 and processor 130 are electrically connected directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The device 110 for detecting circles includes at least one software function module that can be stored in the memory 120 in the form of software or firmware or embedded in the operating system (OS) of the electronic device 100. The processor 130 is used to execute executable modules stored in the memory 120, such as the software function modules and computer programs included in the device 110 for detecting circles.

[0030] The memory 120 may be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory 120 is used to store programs, and the processor 130 executes the programs after receiving execution instructions.

[0031] Please refer to Figure 2 , Figure 2 For application Figure 1 The flowchart below shows a method for detecting a circle in an electronic device 100. The method includes detailed explanations of each step.

[0032] S201: Obtain input point cloud data.

[0033] The input point cloud data is a single-layer point cloud.

[0034] S202: Calculate the initial radius based on the input point cloud data.

[0035] S203: Repeat the random sampling operation N times, each time selecting two different sampling points from the input point cloud data.

[0036] S204: Determine the radius voting range based on each set of sampling points.

[0037] S205: Discrete sampling is performed within the radius voting range according to a preset step size to generate multiple first radii.

[0038] S206: Generate the corresponding voting position based on each first radius.

[0039] S207: Obtain the position with the largest vote and the maximum vote value corresponding to the largest vote from each voting position.

[0040] S208: When the maximum vote value is greater than the preset vote value, calculate the second radius based on the maximum vote position.

[0041] S209: Detect circles from input point cloud data based on the maximum voting position and the second radius.

[0042] Calculate the centroid of the input point cloud data, remove the centroid from the input point cloud to obtain the first point cloud data after centroid removal, traverse the points in the first point cloud data, and calculate the average length of all points as the initial radius.

[0043] Points in the input point cloud data are sampled, with two points obtained each time. The random sampling operation is repeated N times. Based on the basic geometric properties of a circle, the perpendicular bisector of each pair of sampled points is calculated. On this line, multiple possible center positions are generated within a certain range based on the initial radius. These positions serve as the radius voting range. Discrete sampling is performed within the radius voting range at a preset step size, resulting in multiple first radii. Based on these multiple first radii, multiple voting positions are generated.

[0044] All generated voting positions are quantized into a discrete "voting accumulator". Each voting position will vote at the corresponding position in the accumulator. The position with the most votes is considered to be the center of the circle with the highest probability, i.e., the maximum voting position.

[0045] After determining the position with the maximum vote, the distance from all points in the input point cloud data to the center of the circle corresponding to that position is calculated. Histograms are then plotted on these distances, and a weighted average strategy is used to find the most frequently occurring distance value, which is taken as the final precise radius, i.e., the second radius.

[0046] Based on the calculated maximum voting position and second radius, count the number of points in the point cloud located on the circle. If the number of inner points exceeds a preset threshold, the circle is successfully detected; otherwise, it is determined that it has not been detected.

[0047] There are several ways to calculate the initial radius based on input point cloud data. In one implementation, such as... Figure 3 As shown, it includes the following steps: S301: Determine the centroid in the input point cloud data.

[0048] S302: Remove the centroid from the input point cloud data to obtain the first point cloud data.

[0049] S303: Calculate the length of each point in the first point cloud data.

[0050] S304: Calculate the average value of each length as the initial radius.

[0051] Calculate the average value of the coordinates of all points in the input point cloud data, and use it as the centroid of the input point cloud data. Subtract the centroid from each point in the input point cloud data to obtain the first point cloud data.

[0052] Calculate the distance from each centroid point in the first point cloud data to the origin, and use this distance as the length of each point. Calculate the mean of each length, and use this mean as the initial radius.

[0053] Aligning the geometric center of the point cloud to the origin of the coordinate system can eliminate the influence of overall positional information and highlight essential features such as shape, structure, or relative spatial relationships.

[0054] There are multiple ways to determine the radius voting range based on each set of sampling points. In one implementation, such as... Figure 4 As shown, it includes the following steps: S401: Determine the midpoint between the first sampling point and the second sampling point.

[0055] S402: Calculate the direction vector perpendicular to the line connecting the first sampling point and the second sampling point.

[0056] S403: Calculate the length of the midpoint.

[0057] S404: Calculate the radius voting range based on the length of the midpoint, the direction vector, and the initial radius.

[0058] In the i-th sampling, the first sampling point and the second sampling point are obtained, that is p 1 point draw p 2 o'clock.

[0059] At this point, we can assume that we have the positions of two points on the circle, and the center of the circle should be located on the perpendicular bisector of these two points.

[0060] By calculating the first sampling point p 1 and second sampling points p Midpoint of 2 p 0, calculate perpendicular to the first sampling point p 1 and second sampling points p The direction vector of the two lines n 0.

[0061] Calculate the midpoint p The length of 0 is denoted as | p 0|.

[0062] The specific implementation method for calculating the radius voting range based on the length of the midpoint, the direction vector, and the initial radius can be as follows: [|p 0| - r ini / 2, | p 0| + r ini / 2], where the minimum value of the radius vote is | p 0| - r ini / 2, the maximum value of the radius vote is | p 0| + r ini / 2,| p 0| is the midpoint p The length of 0, r ini Let be the initial radius.

[0063] The method for generating the corresponding voting position based on each first radius can be as follows: determine the voting position based on the midpoint, the first radius, and the direction vector.

[0064] The specific implementation method for determining the voting position based on the midpoint, the first radius, and the direction vector can be as follows: Let j represent the number of times the radius is sampled. The number of times the radius is sampled is calculated as: (maximum radius vote - minimum radius vote) / radius step size.

[0065] Determine if j is less than the number of samples for the radius. If j is less than the number of samples for the radius, calculate the center position 1 as: p 0+ r j n 0, the center position 2 is: p 0- r j n 0, r j This represents the first radius obtained from the j-th sampling. The center position is... x , y The components are quantized, that is, the x and y components of the first and second circle center positions are quantized to obtain the voting positions.

[0066] For the position of the center x , y The components can be quantified in the following ways: t 1 = int(( p x - t min ) / t size + 0.5), t 2 = int((p y - t min ) / t size + 0.5); t 1, t 2 respectively represent x , y Voting positions after value quantification p x Indicates the position of the center of the circle x Quantity, p y Indicates the position of the center of the circle y Quantity, t min This represents the minimum value for a voting position. t size It is the quantization step size, and int represents the integer part.

[0067] For each set of sampling points, a radius voting range is determined. Based on the radius voting range, the radius is sampled to obtain multiple first radii. Based on the midpoint, the first radius, and the direction vector, the corresponding voting position under that set of sampling points is determined. After all the points in the input point cloud data have been sampled, all the voting positions are obtained.

[0068] There are multiple ways to obtain the maximum voting position and the maximum vote value corresponding to the maximum voting position from all voting positions. In one implementation, such as... Figure 5 As shown, it includes the following steps: S501: Determine the vote value for each voting position.

[0069] S502: Obtain the maximum vote value from all quantities.

[0070] S503: Determine the voting position corresponding to the maximum voting value as the maximum voting position.

[0071] The vote accumulator finds the position with the maximum vote and the maximum vote value.

[0072] When the maximum vote value is greater than the preset vote value, there are several ways to calculate the second radius based on the position of the maximum vote. In one implementation, such as... Figure 6 As shown, it includes the following steps: S601: Calculate the set of distances between each point in the input point cloud data and the center of the circle corresponding to the position with the largest vote.

[0073] S602: Construct a histogram based on distance sets.

[0074] The histogram contains multiple histogram subgraphs, each indicating the number of distances.

[0075] S603: Use variable i to traverse the distance set and determine the distance corresponding to variable i.

[0076] S604: Quantize the distance corresponding to variable i to obtain the quantized value.

[0077] S605: Update the histogram based on the quantization value to obtain the updated histogram.

[0078] S606: Obtain the largest histogram subgraph from the updated histogram.

[0079] S607: Obtain the first and second histograms adjacent to the largest histogram from the updated histogram.

[0080] S608: Calculate the second radius based on the maximum histogram, the first histogram, and the second histogram.

[0081] The voting position corresponding to the maximum voting value determined by the voting mechanism is taken as the maximum voting position. It is then determined whether the maximum voting value is less than or equal to 10. If it is, it is considered that no circle has been detected, and the algorithm ends.

[0082] When the maximum vote value is greater than the preset vote value, determine the center of the circle corresponding to the position of the maximum vote value, traverse the points in the input point cloud data, and obtain the i-th point. p i The distance between a point in the input point cloud data and the center of the circle corresponding to the position with the largest vote is calculated using the following formula: r i = | p i - c |, among which c This represents the center of the circle corresponding to the calculated position with the most votes. r i It is the distance from the i-th point to the center of the circle. r i Save it into the distance set rs.

[0083] A histogram is built based on a distance set. The distance set `rs` is traversed using distance `i`. It is checked whether `i` is less than the size of `rs`. If `i` is less than the size of `rs`, the distance `r_i` corresponding to variable `i` is determined. The distance corresponding to variable `i` is then quantized to obtain the quantized value. Quantization can be performed based on the following formula: r_i1 = int(r_i / r_size2 + 0.5), where r_size2 represents the radius quantization step size, r_i1 is the quantized value of r_i, and int represents rounding.

[0084] Based on the quantization value, add 1 to the r_i1 position of the histogram, that is, h[r_i1] = h[r_i1] + 1.

[0085] After traversing the distance set, the updated histogram is obtained. Through histogram statistics, similar r_i will accumulate at the same position in the histogram, while different r_i will be distributed at different positions in the histogram.

[0086] Let max_vote = 0, where max_vote represents the maximum value in the histogram, i.e., the maximum histogram subgraph. Traverse each histogram subgraph in the updated histogram, and check if h[i] is greater than max_vote. If it is, let max_vote = h[i] and max_vote_index = i. After traversing all histogram subgraphs in the updated histogram, obtain the maximum histogram subgraph, the first histogram subgraph adjacent to the maximum histogram subgraph, and the second histogram subgraph from the updated histogram.

[0087] The second radius is obtained by weighted summation of the first histogram subgraph h[max_vote_index-1], the maximum histogram subgraph h[max_vote_index], and the second histogram subgraph h[max_vote_index+1].

[0088] The specific formula for calculating the second radius is as follows: r = ((max_vote_index - 1) h[max_vote_index-1] + max_vote_index h[max_vote_index] + (max_vote_index + 1) The second radius is calculated using a histogram-based statistical method, where the position corresponding to the most significant statistical value in the histogram is used as the radius. This method is employed because during the voting process, only the center position is voted on, meaning the center position can be recovered from the vote accumulator. After obtaining the center position, the distance from each point in the point cloud to the center is calculated. When a point is on the circle, the distance is close to the radius value, and the points at the same position in the histogram are accumulated. When a point is not on the circle, the distance differs from the radius value and is dispersed in the histogram. After the histogram is calculated, the position corresponding to the most significant statistical value in the histogram is the second radius.

[0089] There are several ways to detect circles from input point cloud data based on the maximum voting position and the second radius. In one implementation, such as... Figure 7 As shown, it includes the following steps: S701: Calculate the first distance between each point in the input point cloud data and the center of the circle corresponding to the position with the largest vote.

[0090] S702: For each first distance, calculate the difference between the first distance and the second radius.

[0091] S703: When the absolute value of the difference is less than the preset threshold, the point is taken as a point on the circle.

[0092] S704: Determine the number of points on the circle.

[0093] S705: When the number is greater than or equal to the preset point number threshold, the circles of the input point cloud data are obtained based on the points on each circle.

[0094] Based on the calculated center and second radius of the circle corresponding to the position with the largest vote, traverse the points in the input point cloud data to obtain the number of points on the circle.

[0095] If the absolute value of the difference between the distance from a point in the input point cloud data to the center of the circle corresponding to the maximum voting position and the second radius is less than a preset threshold, the point is considered to be on the circle, and the number of points on the circle is counted.

[0096] The algorithm checks if the number of points on the circle is greater than or equal to a preset point threshold. If not, it considers no circle detected and the algorithm terminates. If yes, it considers a circle detected and the algorithm terminates.

[0097] Please refer to Figure 8 This application embodiment also provides an application for Figure 1 The device 110 for detecting circles in the electronic device 100 includes: The acquisition module 111 is used to acquire input point cloud data, wherein the input point cloud data is a single-layer point cloud; The determining module 112 is used to calculate the initial radius based on the input point cloud data; The acquisition module 111 is also used to repeatedly perform a random sampling operation N times, each time selecting two different sampling points from the input point cloud data; The determining module 112 is further configured to determine the radius voting range based on each set of sampling points; perform discrete sampling within the radius voting range at a preset step size to generate multiple first radii; generate a corresponding voting position based on each first radius; obtain the maximum voting position and the maximum voting value corresponding to the maximum voting position from each voting position; and calculate a second radius based on the maximum voting position when the maximum voting value is greater than a preset voting value. The detection module 113 is used to detect a circle from the input point cloud data based on the maximum voting position and the second radius.

[0098] This application also provides an electronic device 100, which includes a processor 130 and a memory 120. The memory 120 stores computer-executable instructions, which, when executed by the processor 130, implement the method for detecting a circle.

[0099] This application embodiment also provides a computer-readable storage medium storing a computer program, which, when executed by a processor 130, implements the three-dimensional face model training method.

[0100] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0101] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part. If the function is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.

[0102] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0103] The above descriptions are merely various embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for detecting a circle, characterized in that, The method includes: Acquire input point cloud data, wherein the input point cloud data is a single-layer point cloud; Calculate the initial radius based on the input point cloud data; Repeat the random sampling operation N times, each time selecting two different sampling points from the input point cloud data; Based on each set of sampling points, determine the radius voting range; Within the radius voting range, discrete sampling is performed at a preset step size to generate multiple first radii; Generate a corresponding voting position based on each of the first radii; Obtain the maximum voting position and the maximum voting value corresponding to the maximum voting position from each of the voting positions; When the maximum vote value is greater than the preset vote value, a second radius is calculated based on the maximum vote position; Based on the maximum voting position and the second radius, a circle is detected from the input point cloud data.

2. The method according to claim 1, characterized in that, The step of calculating the initial radius based on the input point cloud data includes: Determine the centroid in the input point cloud data; The centroid of the input point cloud data is removed to obtain the first point cloud data; Calculate the length of each point in the first point cloud data; Calculate the average of the given lengths as the initial radius.

3. The method according to claim 1, characterized in that, Each set of sampling points includes a first sampling point and a second sampling point. The step of determining the radius voting range based on each set of sampling points includes: Determine the midpoint between the first sampling point and the second sampling point; Calculate the direction vector perpendicular to the line connecting the first sampling point and the second sampling point; Calculate the length of the midpoint; The radius voting range is calculated based on the length of the midpoint, the direction vector, and the initial radius.

4. The method according to claim 3, characterized in that, The step of generating a corresponding voting position based on each of the first radii includes: The voting position is determined based on the midpoint, the first radius, and the direction vector.

5. The method according to claim 1, characterized in that, The step of obtaining the maximum voting position and the maximum voting value corresponding to the maximum voting position from each of the voting positions includes: Determine the vote value for each voting position; Obtain the maximum vote value from each quantity; The voting position corresponding to the maximum voting value is determined as the maximum voting position.

6. The method according to claim 2, characterized in that, The step of calculating the second radius based on the maximum voting position when the maximum voting value is greater than the preset voting value includes: When the maximum vote value is greater than the preset vote value, calculate the set of distances between each point in the input point cloud data and the center of the circle corresponding to the maximum vote position; A histogram is constructed based on the distance set, wherein the histogram contains multiple histogram subgraphs, and the histogram subgraphs indicate the number of distances. Use variable i to traverse the distance set and determine the distance corresponding to variable i; The distance corresponding to variable i is quantized to obtain a quantized value; The histogram is updated based on the quantization value to obtain the updated histogram; Obtain the maximum histogram subgraph from the updated histogram; Obtain the first and second histograms adjacent to the maximum histogram from the updated histogram; The second radius is calculated based on the maximum histogram, the first histogram, and the second histogram.

7. The method according to claim 1, characterized in that, The step of detecting a circle from the input point cloud data based on the maximum voting position and the second radius includes: Calculate the first distance between each point in the input point cloud data and the center of the circle corresponding to the maximum voting position; For each of the first distances, calculate the difference between the first distance and the second radius; When the absolute value of the difference is less than a preset threshold, the point is taken as a point on the circle; Determine the number of points on the circle; When the number is greater than or equal to a preset point threshold, the circle of the input point cloud data is obtained based on the points on each circle.

8. A device for detecting circles, characterized in that, The device includes: An acquisition module is used to acquire input point cloud data, wherein the input point cloud data is a single-layer point cloud; The determination module is used to calculate the initial radius based on the input point cloud data; The acquisition module is also used to repeatedly perform a random sampling operation N times, each time selecting two different sampling points from the input point cloud data; The determination module is also used to determine the radius voting range based on each set of sampling points; to perform discrete sampling within the radius voting range at a preset step size to generate multiple first radii; to generate a corresponding voting position based on each first radius; to obtain the maximum voting position and the maximum voting value corresponding to the maximum voting position from each voting position; and to calculate a second radius based on the maximum voting position when the maximum voting value is greater than a preset voting value. A detection module is used to detect circles from the input point cloud data based on the maximum voting position and the second radius.

9. An electronic device, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method according to any one of claims 1-7.

10. A storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method described in any one of claims 1-7.