CN113658156A - Sphere fitting method and device for removing local outliers in depth image - Google Patents

Sphere fitting method and device for removing local outliers in depth image Download PDF

Info

Publication number
CN113658156A
CN113658156A CN202110973140.7A CN202110973140A CN113658156A CN 113658156 A CN113658156 A CN 113658156A CN 202110973140 A CN202110973140 A CN 202110973140A CN 113658156 A CN113658156 A CN 113658156A
Authority
CN
China
Prior art keywords
sphere
points
spheres
depth data
candidate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110973140.7A
Other languages
Chinese (zh)
Inventor
彭楷烽
姚毅
杨艺
全煜鸣
金刚
彭斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Lingyun Shixun Technology Co ltd
Luster LightTech Co Ltd
Original Assignee
Shenzhen Lingyun Shixun Technology Co ltd
Luster LightTech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Lingyun Shixun Technology Co ltd, Luster LightTech Co Ltd filed Critical Shenzhen Lingyun Shixun Technology Co ltd
Priority to CN202110973140.7A priority Critical patent/CN113658156A/en
Publication of CN113658156A publication Critical patent/CN113658156A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10028Range image; Depth image; 3D point clouds

Abstract

The invention relates to a sphere fitting method and a sphere fitting device for removing local outliers in a depth image, wherein the method comprises the following steps: selecting effective depth data points and corresponding normal vectors thereof in the depth image, wherein the number of the selected effective depth data points is at least four; fitting the effective depth data points to obtain a plurality of candidate spheres; calculating the distance from the effective depth data point to the candidate sphere, and calculating the angle between the normal vector corresponding to the effective depth data point and the ideal normal vector; performing loop iteration on the candidate spheres, and selecting the candidate sphere with the most corresponding inner points as a suboptimal sphere; taking the suboptimal sphere as an initial value, and fitting the inner points of the suboptimal sphere to obtain an optimal sphere; and carrying out iterative optimization on the optimized sphere, and selecting the optimized sphere with the most corresponding inner points as the optimal sphere. According to the method, a small number of effective depth data points are selected for fitting, the number of times of iterative optimization is increased, a more reliable and accurate sphere fitting result can be obtained, and finally the obtained optimal sphere error is minimum.

Description

Sphere fitting method and device for removing local outliers in depth image
Technical Field
The application relates to the technical field of visual images, in particular to a sphere fitting method and device for removing local outliers in a depth image.
Background
In the field of visual images, depth images may reflect three-dimensional information of a photographed object. The gray value of each pixel point in the depth image can be used for representing the distance between a certain point in an image scene and the camera, and if the depth image has a shot image of an object, the three-dimensional geometric shape of the visible surface of the object can be directly reflected by expressing the image pixel points of the object. Further, in industrial detection, a depth image of an object to be detected can be obtained by shooting, then pixel points of all or part of the contour of the object to be detected in the depth image are fitted, and then a corresponding fitted image is obtained, and then industrial detection of the object to be detected, such as height measurement, volume measurement and other related detection operations, is realized based on the fitted image.
However, as shown in fig. 1, in addition to the interior points that can participate in the fitting, there are local exterior points that are generated due to environmental influences or defects existing in the object to be detected, where the interior points refer to pixel points whose distance from the surface of the object to be detected is less than or equal to the error distance, and the local exterior points refer to pixel points whose distance from the surface of the object to be detected is greater than the error distance. However, when fitting the pixel points of the whole contour or part of the contour of the object to be detected in the depth image, if the pixel points participating in the fitting include local outliers, the fitted image obtained by fitting has a large error, and further the subsequent measurement or detection of the height and the volume of the object to be detected is inaccurate. Therefore, it is necessary to remove the outliers in the depth image.
However, when removing the outliers in the depth image, the shape of the object to be detected also needs to be considered. Most of the objects to be detected are formed by quadric surfaces such as a spherical surface, a cylindrical surface or a conical surface, if the objects to be detected with different shapes are shot, the obtained depth images are different, and for different depth images, a method for removing local outliers in the depth images corresponding to the shapes of the objects to be detected is required. For example, when the object to be detected is a sphere, the prior art adopts a method for removing the local outlier of the sphere, for example, a least square method is used to remove the local outlier in the sphere.
The common operation steps of the method for removing the local outliers are that firstly, fitting operation is carried out on all pixel points in the depth image to form a suboptimal sphere, then, according to the suboptimal sphere formed by fitting, the local outliers participating in fitting are removed once, and then, the remaining internal points are fitted again to form an optimal sphere. While the way of removing the out-of-office point at one time may have the following two bad situations: 1. not only the local outer points to be removed are removed, but also a small number of inner points are removed, and the number of the inner points which can participate in fitting again is small; 2. the outliers are not completely removed, resulting in remaining inliers that are also doped with outliers, and the points that can participate in the refitting at this time include not only inliers but also outliers that have not been removed. Both of the above two situations may cause inaccurate results of refitting, and the error of the formed optimal sphere is large, so that subsequent measurement or detection of the height and volume of the optimal sphere is inaccurate.
Therefore, the above method cannot accurately remove the interference of the out-of-local points, leaving the optimum number of inner points to achieve efficient and high-precision sphere fitting.
Disclosure of Invention
The application provides a sphere fitting method and device for removing local outliers in a depth image, and aims to solve the problem that the interference of the local outliers cannot be effectively removed by an existing sphere fitting method so as to achieve efficient and high-precision sphere fitting.
The technical scheme adopted by the application is as follows:
as a first aspect, the present invention provides a sphere fitting method for removing local outliers in a depth image, the method comprising:
selecting effective depth data points and corresponding normal vectors thereof in the depth image, wherein the number of the selected effective depth data points is at least four, and the effective depth data points refer to pixel points of which the mask value is true, the data information is-32768, and the normal vector is not a zero vector in the depth image;
fitting the effective depth data points to obtain a plurality of candidate spheres;
calculating the distance from the effective depth data point to a candidate sphere, and calculating the angle between a normal vector corresponding to the effective depth data point and an ideal normal vector;
performing loop iteration on the candidate spheres, and selecting the candidate sphere which corresponds to the most inner points as a suboptimal sphere, wherein the inner points refer to effective depth data points of which the distance is less than or equal to a preset distance threshold value and the angle is less than or equal to a preset angle threshold value;
taking the suboptimal sphere as an initial value, and fitting the inner points of the suboptimal sphere to obtain a plurality of optimal spheres;
and performing iterative optimization on the preferred sphere, and selecting the preferred sphere with the most corresponding inner points as the optimal sphere.
In an implementation manner, performing a loop iteration on the candidate sphere, and selecting the candidate sphere with the most corresponding interior points as a suboptimal sphere includes: and performing loop iteration on the candidate sphere, and outputting the sphere with the most corresponding inner points as a suboptimal sphere if the current iteration times are greater than the maximum iteration times.
Further, if the current iteration number is less than or equal to the maximum iteration number, the following steps are continued:
selecting effective depth data points and corresponding normal vectors thereof in the depth image, wherein the number of the selected effective depth data points is at least four;
fitting the effective depth data points to obtain a plurality of candidate spheres;
calculating the distance from the effective depth data point to a candidate sphere, and calculating the angle between a normal vector corresponding to the effective depth data point and an ideal normal vector;
and performing loop iteration on the candidate spheres, and selecting the candidate sphere with the most corresponding inner points as a suboptimal sphere.
In an implementation manner, iteratively optimizing the preferred sphere to obtain a plurality of preferred spheres, and selecting a preferred sphere having a maximum correspondence of interior points as an optimal sphere includes:
performing iterative optimization on the optimized spheres to obtain a plurality of optimized spheres, and updating the optimized spheres if the inner points of the optimized spheres are increased;
if the inner point of the preferred sphere is not increased any more, the output preferred sphere is the optimal sphere.
Further, the maximum allowable number of iterations is calculated, including: inputting the confidence coefficient and the proportion of the inner points into an iterative model, and calculating the maximum iteration times by the iterative model according to the following formula:
Figure BDA0003226661730000031
in the above formula, P represents the confidence, t represents the ratio of the inner points, N represents the maximum allowable iteration number, and x is the number of the selected data points for fitting the effective depth.
Further, the value range of the confidence coefficient is (0, 1).
In one implementable manner, the method further comprises: and presetting the distance threshold, namely setting the distance threshold meeting the requirement according to the practical application scene of the depth image.
In one implementable manner, the method further comprises: and presetting an angle threshold, namely setting a normal vector angle threshold meeting the requirement according to the practical application scene of the depth image.
In a second aspect, the present invention also provides a sphere fitting apparatus for removing local outliers in a depth image, the apparatus comprising:
the device comprises an effective depth data point selecting unit, a depth image processing unit and a processing unit, wherein the effective depth data point selecting unit is used for selecting effective depth data points and corresponding normal vectors in a depth image, the number of the selected effective depth data points is at least four, and the effective depth data points refer to pixel points of which the mask value is true, the data information is-32768, and the normal vector is not a zero vector in the depth image;
a candidate sphere obtaining unit, configured to fit the effective depth data points to obtain a plurality of candidate spheres;
the calculating unit is used for calculating the distance from the effective depth data point to the candidate sphere and calculating the angle between a normal vector corresponding to the effective depth data point and an ideal normal vector;
the suboptimal sphere obtaining unit is used for performing loop iteration on the candidate spheres, and selecting the candidate sphere which corresponds to the most interior points as the suboptimal sphere, wherein the interior points refer to effective depth data points of which the distance is less than or equal to a preset distance threshold and the angle is less than or equal to a preset angle threshold;
the optimal sphere obtaining unit is used for taking the suboptimal sphere as an initial value and fitting an inner point of the suboptimal sphere to obtain an optimal sphere;
and the optimal sphere obtaining unit is used for carrying out iterative optimization on the optimal spheres to obtain a plurality of optimal spheres, and selecting the optimal spheres with the most corresponding inner points as the optimal spheres.
In a third aspect, the present invention also provides a computer device, comprising: one or more processors; memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement a sphere fitting method of removing outliers in a depth image as described above.
The technical scheme of the application has the following beneficial effects:
the invention discloses a sphere fitting method and a sphere fitting device for removing local outliers in a depth image, wherein the sphere fitting method comprises the following steps: selecting effective depth data points and corresponding normal vectors thereof in the depth image, wherein the number of the selected effective depth data points is at least four; fitting the effective depth data points to obtain a plurality of candidate spheres; calculating the distance from the effective depth data point to the candidate sphere, and calculating the angle between the normal vector corresponding to the effective depth data point and the ideal normal vector; performing loop iteration on the candidate spheres, and selecting the candidate sphere with the most corresponding inner points as a suboptimal sphere; taking the suboptimal sphere as an initial value, and fitting the inner points of the suboptimal sphere to obtain an optimal sphere; and performing iterative optimization on the optimized spheres to obtain a plurality of optimized spheres, and selecting the optimized spheres with the most corresponding inner points as the optimal spheres.
According to the method, a small number of effective depth data points are selected for fitting, and the number of times of iterative optimization is increased, so that the removal of local outliers can be better realized, and a more reliable and accurate sphere fitting result can be obtained; further, by increasing the constraint of the number of inner points, the fitting is closer to the real situation.
The method removes the interference data (local points) on the surface of the sphere under the condition of no pretreatment, thereby leaving effective information reflecting the real condition of the object; the finally obtained optimal sphere has the minimum error, so that the subsequent measurement or detection of the height and the volume of the optimal sphere is more accurate.
Drawings
In order to more clearly explain the technical solution of the present application, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious to those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic diagram of an inner point and an outer point of a sphere fitting method for removing outer points in a depth image according to an embodiment of the present invention;
FIG. 2 is a flowchart of a sphere fitting method for removing outliers in a depth image according to an embodiment of the present invention;
fig. 3 is a flowchart of obtaining a suboptimal sphere and an optimal sphere by a sphere fitting method for removing local outliers in a depth image according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following examples do not represent all embodiments consistent with the present application. But merely as exemplifications of systems and methods consistent with certain aspects of the application, as recited in the claims.
When the object to be detected is spherical, the depth image shown in fig. 1 can be obtained, wherein the depth image includes local points generated due to environmental influences or defects of the object to be detected and other factors, in addition to the internal points which can participate in fitting. However, when fitting the pixel points of the whole contour or part of the contour of the object to be detected in the depth image, if the pixel points participating in the fitting include local outliers, the fitted image obtained by fitting has a large error, and further the subsequent measurement or detection of the height and the volume of the object to be detected is inaccurate. Therefore, it is necessary to remove the outliers in the depth image.
However, the fitting result of removing the local outliers in the sphere by the least square method is not accurate, the error of the formed optimal sphere is large, and the subsequent measurement or detection of the height and the volume of the optimal sphere is not accurate. Accordingly, the present application provides a sphere fitting method, apparatus, computer device and computer readable medium for removing outliers in a depth image, which are described in detail below.
As a first aspect, as shown in fig. 1 to 3, the present application provides a sphere fitting method for removing local outliers in a depth image, including:
s01: and randomly selecting effective depth data points in the depth image and the corresponding normal vectors thereof.
The number of the randomly selected effective depth data points is at least four, the effective depth data points refer to pixel points of which the mask value is true, the data information is-32768, the normal vector is not zero, and at least three neighborhood points exist in the depth image.
It should be noted that: in the present application, an effective depth data point refers to point cloud data obtained through a series of screening from pixel points of a depth image.
Because the depth image has invalid pixel points, the invalid pixel points in the depth image are removed firstly, the invalid pixel points refer to pixel points with a mask value of false in the depth image, and valid pixel points with a mask value of true are left. And selecting data information from-32768, wherein normal vectors are not zero vectors, and at least three pixel points of neighborhood points exist, so that pixel points needing fitting in the application, namely effective depth data points, can be obtained.
Further, in the embodiment of the present invention, four effective depth data points are selected for fitting. The method can avoid the problems that the number of iteration times is greatly increased due to excessive effective depth data points selected each time, and the feasibility of a suboptimal sphere acquisition scheme is reduced.
S02: and fitting the effective depth data points to obtain a plurality of candidate spheres.
S03: and calculating the distance from the effective depth data point to the candidate sphere, and calculating the angle between the normal vector corresponding to the effective depth data point and the ideal normal vector.
It can be understood that, here, the distance from the effective depth data point to the candidate sphere and the effective depth data point in the angle between the normal vector corresponding to the effective depth data point and the ideal normal vector are calculated, and effective depth data points which are not located on the candidate sphere after the plurality of candidate spheres are obtained for fitting.
S04: performing loop iteration on the candidate spheres, and selecting the candidate sphere which corresponds to the most inner points as a suboptimal sphere, wherein the inner points refer to effective depth data points of which the distance is less than or equal to a preset distance threshold value and the angle is less than or equal to a preset angle threshold value;
the maximum allowable iteration count calculation in this embodiment includes:
inputting the confidence coefficient and the proportion of the inner points (the proportion of the inner points to the sum of the inner points and the outer points) into an iterative model, wherein the iterative model calculates the maximum iteration times by the following formula:
Figure BDA0003226661730000051
in the above formula, P represents the confidence, t represents the ratio of the inner points, N represents the maximum allowable iteration number, and x is the number of the selected data points for fitting the effective depth.
Specifically, the confidence level ranges from (0, 1). Preferably, the confidence level is set to 0.8, which can meet the practical requirement of removing the outlier in most application scenarios.
When the effective depth data points in the four depth images are selected to be matched with the corresponding normal vectors, the above formula is as follows:
Figure BDA0003226661730000052
wherein, the smaller t is, the more iteration times are calculated, and the more reliable the fitting result is; meanwhile, the higher the confidence degree P is, the more the number of iterations is calculated, and the more reliable the fitting result is. Namely, the method and the device can obtain more credible results by increasing the iteration times, and achieve better effect of removing the outlier.
Further, in step S04, performing loop iteration on the candidate spheres, and selecting the candidate sphere with the most corresponding interior points as a suboptimal sphere specifically includes:
s041: performing loop iteration on the candidate spheres, and outputting a sphere with the most corresponding inner points as a suboptimal sphere if the current iteration times are greater than the maximum iteration times;
s042: if the current iteration times are less than or equal to the maximum iteration times, continuing to perform the following steps:
randomly selecting effective depth data points and corresponding normal vectors in the depth image, wherein the number of the randomly selected effective depth data points is at least four;
fitting the effective depth data points to obtain a plurality of candidate spheres;
calculating the distance from the effective depth data point to the candidate sphere, and calculating the angle between the normal vector corresponding to the effective depth data point and the ideal normal vector;
and performing loop iteration on the candidate spheres, and selecting the candidate sphere with the most corresponding inner points as a suboptimal sphere.
In step S04, an iterative loop is performed on the plurality of candidate spheres, and the candidate sphere having the most corresponding interior points is selected as the suboptimal sphere, which can be understood that the sphere having the most corresponding interior points is more accurate, whereas the less interior points correspond to the larger sphere error, and thus the candidate sphere having the most corresponding interior points is selected as the suboptimal sphere in this step.
S05: and taking the suboptimal sphere as an initial value, and fitting the inner points of the suboptimal sphere to obtain the optimal sphere.
It should be noted that one sphere is preferable in step S05.
S06: and performing iterative optimization on the optimized spheres to obtain a plurality of optimized spheres, and selecting the optimized spheres with the most corresponding inner points as the optimal spheres.
The interior points are recalculated for each optimization iteration of the preferred cone obtained in step S05, and fitting is performed again by using the interior points, so that a plurality of preferred cones can be obtained through fitting.
Further, step S06 specifically includes the following steps:
carrying out iterative optimization on the optimized spheres to obtain a plurality of optimized spheres, and updating the optimized spheres if the inner points of the optimized spheres are increased;
if the inner point of the preferred sphere is not increased any more, the output preferred sphere is the optimal sphere.
In the application, four effective depth data points are selected for fitting to form a plurality of candidate spheres; performing iterative optimization on the candidate spheres, and selecting the candidate sphere with the most corresponding inner points as a suboptimal sphere; then, the suboptimal sphere is used as an initial value, and the interior points of the suboptimal sphere are fitted to obtain a plurality of optimal spheres; and then carrying out iterative optimization on the optimized sphere, and selecting the optimized sphere with the most corresponding inner points as the optimal sphere. According to the method, a small number of effective depth data points are selected for fitting, iteration optimization is conducted on the fitting result for multiple times until the optimal sphere is obtained, the optimal sphere is obtained in the optimal sphere obtaining mode, the error of the obtained optimal sphere is minimum, and then the follow-up measurement or detection on the height and the volume of the optimal sphere is accurate.
In one implementation, the method further comprises: and presetting the distance threshold, namely setting the distance threshold meeting the requirement according to the practical application scene of the depth image.
When the distance threshold is used as a criterion for evaluating the inner and outer points: if the distance from the point to the sphere is greater than the distance threshold, the point is an outer point; and if the distance from the point to the sphere is less than or equal to the distance threshold value, the point is an inner point. As shown in fig. 1, the range of the dotted line formed by the inner side and the outer side of the sphere is a distance threshold, and it can be seen that the distance from a point to the sphere is equal to or less than the distance threshold, the point is an inner point, and the distance from the point to the sphere is greater than the distance threshold, the point is an outer point.
It should be noted that the larger the distance threshold is set, the more the inner points on the fitting sphere are proved to be, the less the local outer points are removed, so that the distance threshold needs to be determined according to actual image data, and the distance threshold can also be set according to actual needs.
In an implementation, the method further comprises: and presetting an angle threshold, namely setting a normal vector angle threshold meeting the requirement according to the practical application scene of the depth image.
When the normal vector angle threshold is used as another criterion for evaluating the inner and outer points: if the angle between the normal vector of the point and the ideal normal vector is larger than the angle threshold value, the point is an outer point; if the angle between the normal vector of the point and the ideal normal vector is less than or equal to the angle threshold, the point is an interior point.
In the present application, the distance threshold is generally used when the proportion of the outlier is not large; the normal vector angle threshold is generally used when the proportion of the outlier is large, and both of the normal vector angle threshold and the outlier can be used at this time. Of course, if the ratio of outliers is not large, a normal vector angle threshold may be added if a better initial result is desired. This is because the estimation of the normal vector is less affected by the outlier and is more accurate when the proportion of the outlier is not large; when the proportion of the local outliers is large, the estimation of the normal vector is greatly influenced by the local outliers, so that the obtained normal vector is not accurate, and more local outliers can be screened out by utilizing the angle threshold of the normal vector.
The method can remove the interference data on the surface of the sphere under the condition of no pretreatment, and can effectively remove the local points on the surface of the sphere, thereby leaving effective information reflecting the real condition of the object; meanwhile, fitting is carried out by using data of the removed local outliers, and a more reliable and accurate sphere fitting result can be obtained by increasing the iteration times, so that the removal of the local outliers is better realized; further, by increasing the constraint of the number of inner points, the fitting is closer to the real situation. The finally obtained optimal sphere has the minimum error, so that the subsequent measurement or detection of the height and the volume of the optimal sphere is more accurate.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
As a second aspect, the present invention also provides a sphere fitting apparatus for removing outliers in a depth image, the apparatus comprising:
the device comprises an effective depth data point selecting unit, a depth image processing unit and a processing unit, wherein the effective depth data point selecting unit is used for selecting effective depth data points and corresponding normal vectors in a depth image, the number of the selected effective depth data points is at least four, and the effective depth data points refer to pixel points of which the mask value is true, the data information is-32768, and the normal vector is not a zero vector in the depth image;
a candidate sphere obtaining unit, configured to fit the effective depth data points to obtain a plurality of candidate spheres;
the calculating unit is used for calculating the distance from the effective depth data point to the candidate sphere and calculating the angle between a normal vector corresponding to the effective depth data point and an ideal normal vector;
the suboptimal sphere obtaining unit is used for performing loop iteration on the candidate spheres, and selecting the candidate sphere which corresponds to the most interior points as the suboptimal sphere, wherein the interior points refer to effective depth data points of which the distance is less than or equal to a preset distance threshold and the angle is less than or equal to a preset angle threshold;
the optimal sphere obtaining unit is used for taking the suboptimal sphere as an initial value and fitting an inner point of the suboptimal sphere to obtain an optimal sphere;
and the optimal sphere obtaining unit is used for carrying out iterative optimization on the optimal spheres to obtain a plurality of optimal spheres, and selecting the optimal spheres with the most corresponding inner points as the optimal spheres.
For the definition of the sphere fitting device for removing the local outliers in the depth image, reference may be made to the above definition of the sphere fitting method for removing the local outliers in the depth image, which is not described herein again. In addition, each module in the sphere simulation apparatus for removing the local outliers in the depth image may be implemented in whole or in part by software, hardware, or a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In a third aspect, the invention also discloses a computer device, which may be a server. The computer device includes: one or more processors for providing computing and control capabilities; memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to perform the steps of: selecting effective depth data points and corresponding normal vectors thereof in the depth image, wherein the number of the selected effective depth data points is at least four; fitting the effective depth data points to obtain a plurality of candidate spheres; calculating the distance from the effective depth data point to the candidate sphere, and calculating the angle between the normal vector corresponding to the effective depth data point and the ideal normal vector; performing loop iteration on the candidate spheres, and selecting the candidate sphere which corresponds to the most inner points as a suboptimal sphere, wherein the inner points refer to effective depth data points of which the distance is less than or equal to a preset distance threshold value and the angle is less than or equal to a preset angle threshold value; taking the suboptimal sphere as an initial value, and fitting the inner points of the suboptimal sphere to obtain an optimal sphere; and performing iterative optimization on the optimized spheres to obtain a plurality of optimized spheres, and selecting the optimized spheres with the most corresponding inner points as the optimal spheres.
As a fourth aspect, the present invention also discloses a computer-readable medium on which a computer program is stored, which may be contained in the apparatus described in the above embodiments or may exist separately without being assembled into the apparatus. The program is executed by the processor to perform the steps of: fitting the effective depth data points to obtain a plurality of candidate spheres; calculating the distance from the effective depth data point to the candidate sphere, and calculating the angle between the normal vector corresponding to the effective depth data point and the ideal normal vector; performing loop iteration on the candidate spheres, and selecting the candidate sphere which corresponds to the most inner points as a suboptimal sphere, wherein the inner points refer to effective depth data points of which the distance is less than or equal to a preset distance threshold value and the angle is less than or equal to a preset angle threshold value; taking the suboptimal sphere as an initial value, and fitting the inner points of the suboptimal sphere to obtain a plurality of optimal spheres; and performing iterative optimization on the preferred sphere, and selecting the preferred sphere with the most corresponding inner points as the optimal sphere.
It is noted that relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that an article or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. The word "comprising", without further limitation, means that the element so defined is not excluded from the list of additional identical elements in a process, method, article, or apparatus that comprises the element.
The above description is merely exemplary of the present application and is presented to enable those skilled in the art to understand and practice the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
It will be understood that the present application is not limited to what has been described above and shown in the accompanying drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A sphere fitting method for removing outliers in a depth image, the method comprising:
selecting effective depth data points and corresponding normal vectors thereof in the depth image, wherein the number of the selected effective depth data points is at least four, and the effective depth data points refer to pixel points of which the mask value is true, the data information is-32768, and the normal vector is not a zero vector in the depth image;
fitting the effective depth data points to obtain a plurality of candidate spheres;
calculating the distance from the effective depth data point to a candidate sphere, and calculating the angle between a normal vector corresponding to the effective depth data point and an ideal normal vector;
performing loop iteration on the candidate spheres, and selecting the candidate sphere which corresponds to the most inner points as a suboptimal sphere, wherein the inner points refer to effective depth data points of which the distance is less than or equal to a preset distance threshold value and the angle is less than or equal to a preset angle threshold value;
taking the suboptimal sphere as an initial value, and fitting the inner points of the suboptimal sphere to obtain an optimal sphere;
and performing iterative optimization on the optimized spheres to obtain a plurality of optimized spheres, and selecting the optimized spheres with the most corresponding inner points as the optimal spheres.
2. The method of claim 1, wherein the performing loop iteration on the candidate spheres to select a candidate sphere with the most corresponding interior points as a sub-optimal sphere comprises:
and performing loop iteration on the candidate sphere, and outputting the sphere with the most corresponding inner points as a suboptimal sphere if the current iteration times are greater than the maximum iteration times.
3. The sphere fitting method for removing local outliers in a depth image of claim 2, wherein if the current iteration number is less than or equal to the maximum iteration number, proceeding with the following steps:
selecting effective depth data points and corresponding normal vectors thereof in the depth image, wherein the number of the selected effective depth data points is at least four;
fitting the effective depth data points to obtain a plurality of candidate spheres;
calculating the distance from the effective depth data point to a candidate sphere, and calculating the angle between a normal vector corresponding to the effective depth data point and an ideal normal vector;
and performing loop iteration on the candidate spheres, and selecting the candidate sphere with the most corresponding inner points as a suboptimal sphere.
4. The sphere fitting method for removing the local outliers in the depth image according to claim 1, wherein the iterative optimization of the preferred sphere is performed to obtain a plurality of preferred spheres, and the preferred sphere having the most corresponding interior points is selected as the optimal sphere, which comprises:
performing iterative optimization on the optimized spheres to obtain a plurality of optimized spheres, and updating the optimized spheres if the inner points of the optimized spheres are increased;
if the inner point of the preferred sphere is not increased any more, the output preferred sphere is the optimal sphere.
5. The sphere fitting method for removing outliers in depth images of any of claims 1 to 4, wherein the maximum number of iterations is calculated, comprising:
inputting the confidence coefficient and the proportion of the inner points into an iterative model, and calculating the maximum iteration times by the iterative model according to the following formula:
Figure FDA0003226661720000021
in the above formula, P represents the confidence, t represents the ratio of the inner points, N represents the maximum allowable iteration number, and x is the number of the selected data points for fitting the effective depth.
6. The sphere fitting method for removing local outliers in a depth image of claim 5, wherein the confidence level is in a range of (0, 1).
7. The sphere fitting method for removing outliers in a depth image of claim 1 or 6, further comprising:
and presetting the distance threshold, namely setting the distance threshold meeting the requirement according to the practical application scene of the depth image.
8. The sphere fitting method for removing outliers in a depth image of claim 1 or 7, further comprising:
and presetting an angle threshold, namely setting a normal vector angle threshold meeting the requirement according to the practical application scene of the depth image.
9. A sphere fitting apparatus for removing outliers in a depth image, said apparatus comprising:
the device comprises an effective depth data point selecting unit, a depth image processing unit and a processing unit, wherein the effective depth data point selecting unit is used for selecting effective depth data points and corresponding normal vectors in a depth image, the number of the selected effective depth data points is at least four, and the effective depth data points refer to pixel points of which the mask value is true, the data information is-32768, and the normal vector is not a zero vector in the depth image;
a candidate sphere obtaining unit, configured to fit the effective depth data points to obtain a plurality of candidate spheres;
the calculating unit is used for calculating the distance from the effective depth data point to the candidate sphere and calculating the angle between a normal vector corresponding to the effective depth data point and an ideal normal vector;
the suboptimal sphere obtaining unit is used for performing loop iteration on the candidate spheres, and selecting the candidate sphere which corresponds to the most interior points as the suboptimal sphere, wherein the interior points refer to effective depth data points of which the distance is less than or equal to a preset distance threshold and the angle is less than or equal to a preset angle threshold;
the optimal sphere obtaining unit is used for taking the suboptimal sphere as an initial value and fitting an inner point of the suboptimal sphere to obtain an optimal sphere;
and the optimal sphere obtaining unit is used for carrying out iterative optimization on the optimal spheres to obtain a plurality of optimal spheres, and selecting the optimal spheres with the most corresponding inner points as the optimal spheres.
10. A computer device, comprising:
one or more processors;
a memory for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the sphere fitting method of removing outliers in a depth image of any of claims 1-8.
CN202110973140.7A 2021-08-24 2021-08-24 Sphere fitting method and device for removing local outliers in depth image Pending CN113658156A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110973140.7A CN113658156A (en) 2021-08-24 2021-08-24 Sphere fitting method and device for removing local outliers in depth image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110973140.7A CN113658156A (en) 2021-08-24 2021-08-24 Sphere fitting method and device for removing local outliers in depth image

Publications (1)

Publication Number Publication Date
CN113658156A true CN113658156A (en) 2021-11-16

Family

ID=78492617

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110973140.7A Pending CN113658156A (en) 2021-08-24 2021-08-24 Sphere fitting method and device for removing local outliers in depth image

Country Status (1)

Country Link
CN (1) CN113658156A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114782508A (en) * 2022-06-21 2022-07-22 杭州三坛医疗科技有限公司 Hip joint registration point screening method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018198298A1 (en) * 2017-04-27 2018-11-01 日本電気株式会社 Parameter estimation device, parameter estimation method, and computer-readable recording medium
CN112085759A (en) * 2020-09-07 2020-12-15 凌云光技术股份有限公司 Straight line fitting method and device based on big data
CN112085773A (en) * 2020-09-07 2020-12-15 深圳市凌云视迅科技有限责任公司 Plane fitting method and device for removing local outliers
CN112529948A (en) * 2020-12-25 2021-03-19 南京林业大学 Mature pomegranate positioning method based on Mask R-CNN and 3-dimensional sphere fitting
CN113205139A (en) * 2021-05-06 2021-08-03 南京云智控产业技术研究院有限公司 Unmanned ship water sphere detection method based on density clustering
CN113240753A (en) * 2021-05-26 2021-08-10 广西玉林玉柴通用机械有限公司 Sphere fitting method for calibrating base coordinate system of robot and double-shaft deflection mechanism

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018198298A1 (en) * 2017-04-27 2018-11-01 日本電気株式会社 Parameter estimation device, parameter estimation method, and computer-readable recording medium
CN112085759A (en) * 2020-09-07 2020-12-15 凌云光技术股份有限公司 Straight line fitting method and device based on big data
CN112085773A (en) * 2020-09-07 2020-12-15 深圳市凌云视迅科技有限责任公司 Plane fitting method and device for removing local outliers
CN112529948A (en) * 2020-12-25 2021-03-19 南京林业大学 Mature pomegranate positioning method based on Mask R-CNN and 3-dimensional sphere fitting
CN113205139A (en) * 2021-05-06 2021-08-03 南京云智控产业技术研究院有限公司 Unmanned ship water sphere detection method based on density clustering
CN113240753A (en) * 2021-05-26 2021-08-10 广西玉林玉柴通用机械有限公司 Sphere fitting method for calibrating base coordinate system of robot and double-shaft deflection mechanism

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"《计算机工程与应用》2012年(第48卷)总目次", 计算机工程与应用, no. 36, 21 December 2012 (2012-12-21) *
吉训生;王大智;: "正负类双超球体模型在电梯故障诊断的应用", 信息与控制, no. 03, 15 June 2020 (2020-06-15) *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114782508A (en) * 2022-06-21 2022-07-22 杭州三坛医疗科技有限公司 Hip joint registration point screening method and device

Similar Documents

Publication Publication Date Title
CN110307838B (en) Robot repositioning method and device, computer-readable storage medium and robot
US8755630B2 (en) Object pose recognition apparatus and object pose recognition method using the same
CN112085773A (en) Plane fitting method and device for removing local outliers
CN113658156A (en) Sphere fitting method and device for removing local outliers in depth image
Ma et al. Towards no-reference image quality assessment based on multi-scale convolutional neural network
CN113706505A (en) Cylinder fitting method and device for removing local outliers in depth image
US11557019B1 (en) Homography generation for image registration in inlier-poor domains
CN107085843B (en) System and method for estimating modulation transfer function in optical system
CN114764823A (en) Self-correcting depth calculation method, system, medium, and depth image processing apparatus
CN113654461A (en) Cone fitting method and device for removing local outliers in depth image
CN111291611A (en) Pedestrian re-identification method and device based on Bayesian query expansion
CN116385369A (en) Depth image quality evaluation method and device, electronic equipment and storage medium
CN113033542B (en) Method and device for generating text recognition model
CN115018922A (en) Distortion parameter calibration method, electronic device and computer readable storage medium
CN114842213A (en) Obstacle contour detection method and device, terminal equipment and storage medium
CN111292414B (en) Method and device for generating three-dimensional image of object, storage medium and electronic equipment
CN109242894B (en) Image alignment method and system based on mobile least square method
CN111382834B (en) Confidence degree comparison method and device
CN110009625B (en) Image processing system, method, terminal and medium based on deep learning
CN108764110B (en) Recursive false detection verification method, system and equipment based on HOG characteristic pedestrian detector
CN112598665A (en) Method and device for detecting vanishing points and vanishing lines of Manhattan scene
CN116778066B (en) Data processing method, device, equipment and medium
US11423571B2 (en) Systems and methods for image-based component detection
CN114049444B (en) 3D scene generation method and device
US20240112347A1 (en) Method for detecting nested closed shapes in an image

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination