CN106952307B - Method and system for positioning sphere in image - Google Patents

Method and system for positioning sphere in image Download PDF

Info

Publication number
CN106952307B
CN106952307B CN201710173876.XA CN201710173876A CN106952307B CN 106952307 B CN106952307 B CN 106952307B CN 201710173876 A CN201710173876 A CN 201710173876A CN 106952307 B CN106952307 B CN 106952307B
Authority
CN
China
Prior art keywords
image
contour
contours
sphere
circle
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.)
Expired - Fee Related
Application number
CN201710173876.XA
Other languages
Chinese (zh)
Other versions
CN106952307A (en
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.)
Guangdong University of Technology
Original Assignee
Guangdong University of Technology
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 Guangdong University of Technology filed Critical Guangdong University of Technology
Priority to CN201710173876.XA priority Critical patent/CN106952307B/en
Publication of CN106952307A publication Critical patent/CN106952307A/en
Application granted granted Critical
Publication of CN106952307B publication Critical patent/CN106952307B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • 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/10004Still image; Photographic image
    • 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/10024Color image

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Geometry (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a method and a system for positioning a sphere in an image, which are characterized in that a shot image is converted into a color space and subjected to binarization processing, the outline of a connected domain is extracted from the obtained binarized image, then the geometric characteristics of a circle are utilized to eliminate non-circular outlines, then fitting ellipses of the rest outlines are obtained, the outline representing the corresponding circle of the sphere in the image is screened out according to the eccentricity of the fitting ellipses of the outline, and the sphere is further positioned in the image according to the screened outline. According to the method and the system for positioning the sphere in the image, disclosed by the invention, firstly, the geometric characteristics of the circle are utilized, and the outline which does not meet the requirements and the non-circular outline are excluded, so that in the subsequent operation of fitting the ellipse to the outline, the operation of fitting the ellipse to the non-circular outline and other irrelevant outlines can be avoided, and therefore, the operation amount is reduced, the operation cost is reduced, and the memory consumption is reduced.

Description

Method and system for positioning sphere in image
Technical Field
The invention relates to the technical field of image processing, in particular to a method and a system for positioning a sphere in an image.
Background
The sphere is an isotropic object, the projection image of the sphere in a plane image is also a graph with isotropic geometric properties, and based on the characteristic of the sphere, in more and more applications, such as unmanned aerial vehicle positioning, the sphere is used for positioning in the image.
In the prior art, Hough circle transformation is mostly used in an algorithm for identifying circles in images, and whether a pixel point is located on a circle is determined according to a 'voting' principle in a parameter space under a polar coordinate system, and finally, the pixel point with the highest voting value is selected as a point where the center of the circle is located. However, the method has the following disadvantages: according to the method, under the condition that the radius of a circle is unknown, pixel points in an image need to be traversed to obtain a voting chart about the point coordinates of the circle center and the radius, so that a large amount of pixel point calculation needs to be carried out, the calculation amount is large, and memory resources are consumed.
Disclosure of Invention
The invention aims to provide a method and a system for positioning a sphere in an image, which can reduce the calculation amount and reduce the memory consumption compared with the existing method.
In order to achieve the purpose, the invention provides the following technical scheme:
a method of sphere positioning in an image, comprising:
extracting the outline of a connected domain from a binary image obtained by preprocessing a shot image to obtain an outline set;
traversing the contour set, and excluding contours of which the contour perimeter is smaller than a first preset value;
traversing the residual contour, and excluding the contour which does not meet a first preset condition, wherein the first preset condition is that the tangent value and the cotangent value of an included angle between the diagonal line of the minimum circumscribed rectangle of the contour and one side are both in a first preset range, and the first preset range is a deviation range taking 1 as a base value;
traversing the residual contours, and excluding contours which do not meet a second preset condition, wherein the second preset condition is that the Euclidean distance between the center point of the minimum circumscribed circle of the contours and the center point of the minimum circumscribed rectangle is within a second preset range;
and traversing the residual contours, solving fitting ellipses of the residual contours, screening out the contours representing the corresponding circles of the spheres in the image according to the eccentricity of the fitting ellipses, and positioning the spheres in the image according to the screened contours.
Optionally, the first preset value is C0,C02 pi r + δ, where r denotes the radius of the smallest circle recognizable in the scene image and δ denotes the error value.
Optionally, the minimum bounding rectangle of the outline is the minimum bounding rectangle along the image horizontal direction.
Optionally, the screening out the contour of the corresponding circle in the image representing the sphere according to the eccentricity of the fitted ellipse includes:
and screening out the contour of the fitting ellipse with the eccentricity larger than the second preset value as the contour of the corresponding circle of the representative sphere in the image.
Optionally, the pre-processing the captured image comprises:
converting the color space of the shot image from an RGB color mode to an HSV color mode to obtain an S-channel image, wherein the color of a sphere arranged in a scene is a pure color which is obviously contrasted with white;
and carrying out binarization processing on the obtained image to obtain a binarized image which is distinguished by a spherical area and a background area.
Optionally, after the binarizing processing on the obtained image, the method further includes:
and performing morphological opening operation processing on the image after the binarization processing.
A system for sphere positioning in an image, comprising:
the contour extraction module is used for extracting the contour of the connected domain from a binary image obtained by preprocessing a shot image to obtain a contour set;
the first contour screening module is used for traversing the contour set and excluding contours of which the contour perimeter is smaller than a first preset value;
the second contour screening module is used for traversing the residual contours and excluding contours which do not meet a first preset condition, wherein the first preset condition is that a tangent value and a cotangent value of an included angle between a diagonal line of a minimum external rectangle of the contour and one side are both within a first preset range, and the first preset range is a deviation range taking 1 as a basic value;
the third contour screening module is used for traversing the residual contours and excluding contours which do not meet a second preset condition, wherein the second preset condition is that the Euclidean distance between the central point of the minimum circumscribed circle of the contour and the central point of the minimum circumscribed rectangle is within a second preset range;
and the positioning module is used for traversing the residual contours, solving the fitting ellipses of the residual contours, screening out the contours representing the corresponding circles of the spheres in the image according to the eccentricity of the fitting ellipses, and positioning the spheres in the image according to the screened contours.
According to the technical scheme, the method and the system for positioning the sphere in the image, provided by the invention, pre-process the shot image to obtain a binary image, extract the contour of the connected domain from the obtained binary image to obtain a contour set to be screened; traversing the contour set, and filtering out non-circular contours which do not meet requirements based on the geometric characteristics of circles; and finally, by solving the fitting ellipses of the rest outlines, screening out the outlines representing the corresponding circles of the spheres in the image according to the eccentricity of the contour fitting ellipses, and further positioning the spheres in the image according to the screened outlines.
According to the method and the system for positioning the sphere in the image, the contour is extracted from the preprocessed binary image, the non-circular contour is eliminated by using the geometric characteristics of the circle, and therefore in the subsequent operation of fitting the contour with an ellipse, the operation of fitting the non-circular contour and other unrelated contours with the ellipse can be avoided, the operation amount is reduced, and the operation cost is reduced. Therefore, the method and the system for positioning the sphere in the image can reduce the operation amount and reduce the memory consumption.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart of a method for locating a sphere in an image according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a minimum bounding rectangle of a contour in an embodiment of the present invention;
fig. 3 is a schematic diagram of a system for locating a sphere in an image according to an embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a method for positioning a sphere in an image according to an embodiment of the present invention includes the steps of:
s10: and extracting the outline of the connected domain from a binary image obtained by preprocessing the shot image to obtain an outline set.
In the method of this embodiment, a shot scene image is first preprocessed to obtain a binarized image in which a sphere region is distinguished from a background region.
Preferably, in the method of this embodiment, the sphere set in the scene is a solid-color sphere with a color that is clearly contrasted with white, and the sphere is used as a sphere to be recognized and a marker, so that the color of the sphere has higher saturation, and the sphere can be clearly distinguished from the background after the image is preprocessed subsequently, which is beneficial to positioning the sphere.
The method for preprocessing the shot scene image specifically comprises the following steps:
s100: and converting the color space of the shot image from an RGB color mode to an HSV color mode to obtain an S-channel image, wherein the color of a sphere arranged in the scene is a pure color with obvious contrast with white.
The color of the sphere serving as the marker is selected to be a pure color with obvious contrast with white, so that the color of the sphere has high saturation, the color space of the shot scene image is converted into an HSV color mode, the sphere and the background area can be obviously contrasted in the extracted S channel image, and after the binarization processing is performed on the S channel image, the sphere area and the background area can be obviously distinguished in the binarization image, so that the circular outline of the sphere image can be more accurately extracted.
In the RGB color scheme, colors are described by three primary color spectrums of red, green and blue, and one color is a superposition of three color channel components of red (R), green (G) and blue (B). In the HSV color model, colors are described in hue (H), saturation (S), and lightness (V). Where the saturation S represents the degree to which the color approaches the spectral color. One color can be seen as the result of a mixture of a certain spectral color and white. The larger the proportion of the spectral color is, the higher the degree of the color close to the spectral color is, the higher the color saturation is, and the more saturated the color is.
S101: and carrying out binarization processing on the obtained image to obtain a binarized image which is distinguished by a spherical area and a background area.
When the obtained S-channel image is subjected to binarization processing, a threshold value may be set accordingly. For example, in the binarization processing process, when the gray level of a pixel point is higher than a threshold value, the value of the pixel point is 255, otherwise, the value of the pixel point is 0. The circular area of the corresponding sphere in the image can be distinguished from the background area by binarization processing.
Preferably, in the method of the present embodiment, the image is subjected to a morphological opening operation after the obtained image is subjected to binarization processing.
The morphological operation is an image processing method performed on a binary image according to a set theory method of Mathematical Morphology (Mathematical Morphology). The morphological opening operation refers to a processing process of firstly corroding and then expanding the image, wherein corrosion is a process of eliminating boundary points and enabling boundaries to contract inwards. Can be used to eliminate small and meaningless objects; dilation is the process of merging all background points in contact with an object into the object, expanding the boundary outward. Can be used to fill in voids in objects.
In the method of the embodiment, the image after the binarization processing is subjected to the morphological opening operation processing, so that small objects in the image can be eliminated, the objects are separated at fine points, the boundary of a larger object is smoothed, and the area of the larger object is not obviously changed at the same time.
And extracting the contour of the connected domain from the image obtained after the processing to obtain a contour set consisting of a series of contours.
In the method of the embodiment, firstly, geometric features of a circle are utilized to filter out contours with the circumferences not meeting requirements and non-circular contours in the extracted contour set. The specific screening process at least comprises the following steps:
s11: and traversing the contour set to exclude contours of which the contour perimeter is smaller than a first preset value.
Simple and tiny interference contours in the extracted contours are firstly eliminated through the step.
Here, the contour perimeter refers to the number of pixel points describing the contour. By this step, the contours having the circumferences smaller than the preset value α in the contour set are excluded.
The maximum value of the first preset value alpha is related to the radius of the identifiable smallest circle in the scene image. Let r be the radius of the smallest circle recognizable in the scene image, and C be the perimeter of a contour0,C02 pi r + δ, δ is the error. In practical application, under the influence of noise, the generated circular profile cannot perfectly fit a standard circle but an ellipse, and the method obtains delta & lt-r through experiments. Setting α ≈ C0-r ≈ (2 pi-1) r, when α ≈ C is satisfied0When-r (2 pi-1) r, simple and fine interference contours can be effectively excluded. But for non-circular contours with perimeters larger than a preset value in the image, it cannot be filtered out by this step.
S12: traversing the residual contour, and excluding the contour which does not meet a first preset condition, wherein the first preset condition is that the tangent value and the cotangent value of the included angle between the diagonal line of the minimum external rectangle of the contour and one side are both in a first preset range, and the first preset range is a deviation range taking 1 as a basic value.
Under the condition that the shooting scene is not extremely uneven in illumination, the projection imaging of the sphere in the image is kept as a circle, and the anisotropic symmetry is kept, so that the extracted contour is screened by using the geometric characteristics of the circle in the step, and irrelevant contours such as non-circular contours in the extracted contour are filtered.
For non-circular contours present in an image, the following are mainly classified: 1, sealing the flat and long parts; 2, the product is complex and fine, and the perimeter exceeds a preset value alpha; and 3, the edges and corners are clear.
In the step, the minimum circumscribed rectangle of the outline is firstly obtained, and the prolate closed outline in the outline set is eliminated by utilizing the geometric characteristics of the minimum circumscribed rectangle of the circle.
Let the minimum bounding rectangle of the outline have a length w and a width h, see fig. 2. In the ideal case, if the contour is a standard circle, the minimum circumscribed rectangle is a square. I.e. w-h, but since the circle onto which the sphere is projected in the image will be distorted to a small extent, it is in most cases not a standard circle but an ellipse with an eccentricity close to 1. Correspondingly, for the minimum circumscribed rectangle of the outline, the tangent value tan theta and the cotangent value cot theta of an included angle theta between the diagonal line and one side are 1 if the outline is a standard circle.
The first preset range is set as a deviation range with 1 as a base value. And solving a tangent value tan theta and a cotangent value cot theta of an included angle theta between the diagonal line of the minimum circumscribed rectangle of each contour and one side, wherein when the tangent value tan theta of the included angle theta exceeds a first preset range or the cotangent value cot theta of the included angle theta exceeds the first preset range, the first preset range can be set to [1, gamma ], the contour is a flat-long closed contour, and the contour is excluded. An exemplary first preset range may be set to [1,1.5 ]. Therefore, the contour which is influenced by noise or has larger distortion of projection error and is flat and long and closed can be filtered by the step.
Specifically, in the method of this embodiment, the minimum bounding rectangle of each contour is obtained, where the obtained minimum bounding rectangle is the minimum bounding rectangle of the contour along the horizontal direction of the image, that is, the sides of the minimum bounding rectangle are parallel to the x axis and the y axis of the image coordinate axis, respectively.
As shown with reference to fig. 2. The method for solving the minimum circumscribed rectangle of the contour along the horizontal direction specifically comprises the steps of traversing pixel points of the contour, finding out four extreme points along the coordinate axis direction in the contour, namely calculating two pixel points (x1, y1), (x2, y2) which are closest and farthest to the y axis in the contour along the abscissa, and two pixel points (x3, y3) and (x4, y4) which are farthest and closest to the x axis along the ordinate, and constructing the circumscribed rectangle by using the contour external tangent lines parallel to the coordinate axis and corresponding to the extreme points to obtain the minimum circumscribed rectangle of the contour along the image horizontal direction. Theoretically, the two pairs of points y1 ═ y2 and x3 ═ x 4. According to the information of the two pairs of points, the length and the width of the minimum circumscribed rectangle can be obtained through | x2-x1| and | y3-y4|, the coordinate of the pixel point at the upper left corner of the rectangle is (x1, y4), and the position and the size of the horizontal minimum circumscribed rectangle can be determined according to the three information.
In the method of the embodiment, the minimum circumscribed rectangle of the outline in the image horizontal direction is obtained, on one hand, compared with the method for calculating the minimum circumscribed rectangle of the global optimal solution, the calculation amount can be reduced; on the other hand, a circle is isotropic and has rotation invariance, and the side lengths of the minimum circumscribed rectangle of any inclination angle are theoretically equal no matter how the circle rotates, and the minimum circumscribed rectangle of the circle is a square in theory, so that the calculated horizontal minimum circumscribed rectangle is the optimal solution. While most non-circular contours do not have this property (e.g., the horizontal minimum bounding rectangle of a square, which is related to the tilt angle of the square), finding the horizontal minimum bounding rectangle can effectively provide information for subsequent processing to remove some non-circular contours that do not have the rotation invariant property.
In this embodiment, the minimum circumscribed rectangle may be calculated by using an algorithm in opencv software of graphics processing software.
S13: traversing the residual contours, and excluding contours which do not meet a second preset condition, wherein the second preset condition is that the Euclidean distance between the center point of the minimum circumscribed circle of the contours and the center point of the minimum circumscribed rectangle is within a second preset range.
Assuming that the radius of the minimum circumscribed circle is r1, for the contour of the standard circle, the minimum circumscribed circle has almost the same difference with itself, and there is a geometric relationship that the minimum circumscribed circle is inscribed in the minimum circumscribed rectangle and is concentric.
For the graphs with clear edges and corners, such as the one-way symmetrical geometric graphs such as a triangular outline and the like, because the contribution of each side to the calculation of the minimum circumscribed rectangle and the minimum circumscribed circle is unequal and has larger difference, the concentric geometric relationship between the minimum circumscribed rectangle and the minimum circumscribed circle cannot occur; for a square, the smallest circumscribed rectangle of its outline is comparable to itself, and has a concentric relationship with its smallest circumscribed circle, but the former is inscribed in the latter.
Therefore, the method of the present embodiment utilizes the geometric relationship between the minimum circumscribed circle and the minimum circumscribed rectangle of the circular outline, and satisfies that 2r1 is max (w, h), i.e. the euclidean distance between the center point Pr of the minimum circumscribed rectangle and the center point Pc of the minimum circumscribed circle is smaller than the preset error value, and the filter condition is used to exclude the outline with a clear width, a positive edge and a clear corner.
In addition, in practical application, in order to eliminate distortion caused by projection error and noise, the diameter of the minimum circumscribed circle should be slightly larger than the side length of the minimum circumscribed rectangle.
In this embodiment, the minimum outer circle may be calculated by using an algorithm in opencv software of graphics processing software.
S14: and traversing the residual contours, solving fitting ellipses of the residual contours, screening out the contours representing the corresponding circles of the spheres in the image according to the eccentricity of the fitting ellipses, and positioning the spheres in the image according to the screened contours.
Through the steps, the non-circular outlines with closed flat lengths and clear edges are filtered, so that fitting ellipse operation of the non-circular outlines in the steps can be avoided, and the operation amount is reduced.
In this step, the contour set is traversed, fitting ellipses of the remaining contours are obtained, and particularly, least square fitting can be adopted to obtain the ellipses of the contours.
Calculating the eccentricity of each ellipse according to the following calculation formula:
Figure DEST_PATH_GDA0001290757390000081
designing filtering conditions, wherein theoretically, when the eccentricity e of a conical curve is equal to 0, the curve is a circle; when e >0, the curve described is an ellipse. But in practice due to the effects of noise and projection errors. The eccentricity of the fitted ellipse of the circular profile obtained by the least squares method is not equal to 0 but slightly larger than 0.
The screening condition can thus be set accordingly such that the eccentricity of the fitted ellipse is greater than a second predetermined value, denoted as e>Beta is used as the reference. Constraint conditions can be obtained
Figure DEST_PATH_GDA0001290757390000091
Coefficient of actual use
Figure DEST_PATH_GDA0001290757390000092
Should be a certain constant, and is specifically adjusted according to the lighting environment of the scene used.
To this end, complex fine-sized contours exceeding a are filtered. And finally, the remaining outline is the outline representing the circle, and is used as the corresponding circle of the representing sphere in the image.
And finally, outputting the successfully recognized circle, the coordinate of the circle center, the radius and other information, thereby positioning the sphere in the image.
In this embodiment, the operation of fitting the contour to the ellipse, the positioning of the center of the circle, and the like may be directly performed by using an algorithm in opencv software of graphics processing software.
The sphere positioning method in the image of the embodiment utilizes the geometric characteristic of circular isotropy symmetry and the geometric relationship between the minimum circumscribed rectangle and the minimum circumscribed circle of the circle as the idea of screening the circular contour, filters out the non-circular contour, and finally screens out the circular contour corresponding to the sphere. The method of the embodiment can also be applied to the identification and positioning of the circular marker in the image, and provides a novel method for identifying the circle in the image.
Compared with the existing method for identifying circles through Hough circle transformation, the method of the embodiment utilizes the characteristics of the color features of the marker in the HSV space and utilizes the geometric characteristics of the marker skillfully according to the geometric relationship between the minimum circumscribed circle and the minimum circumscribed rectangle, thereby avoiding a large amount of pixel point operations in the decision making process, and simultaneously utilizing the geometric characteristics of the minimum circumscribed rectangle as constraint conditions to filter interference. Under the condition of insufficient illumination and sufficient illumination, the method can effectively identify the defects. In the hough transform method in the prior art, a three-dimensional accumulator is needed to obtain a voting chart about the point coordinates of the circle center and the radius size by traversing the pixel points in the image. By combining the above and actual test effects, the method of the invention has the advantages of speed superior to that of the traditional algorithm, small algorithm complexity, high accuracy and capability of coping with different illumination environments.
The sphere positioning method in the image, provided by the invention, has the advantages that the sphere is arranged in the scene to serve as the positioning marker, and the method can be applied to the inspection positioning of the unmanned aerial vehicle, and particularly can be applied to the auxiliary positioning marker of the unmanned aerial vehicle in the power transmission tower inspection task.
Accordingly, referring to fig. 3, an embodiment of the present invention further provides a system for locating a sphere in an image, including:
the contour extraction module 20 is configured to extract a contour of a connected domain from a binarized image obtained by preprocessing a captured image, so as to obtain a contour set;
the first contour screening module 21 is configured to traverse the contour set and exclude contours whose contour perimeters are smaller than a first preset value;
the second contour screening module 22 is configured to traverse the remaining contours and exclude contours that do not satisfy a first preset condition, where the first preset condition is that a tangent value and a cotangent value of an included angle between a diagonal line of a minimum circumscribed rectangle of the contour and one side are both within a first preset range, and the first preset range is a deviation range taking 1 as a base value;
the third contour screening module 23 is configured to traverse the remaining contours and exclude contours that do not satisfy a second preset condition, where the second preset condition is that an euclidean distance between a center point of a minimum circumscribed circle of the contour and a center point of a minimum circumscribed rectangle is within a second preset range;
and the positioning module 24 is configured to traverse the remaining contours, obtain fitting ellipses of the remaining contours, screen out contours representing circles corresponding to the spheres in the image according to eccentricities of the fitting ellipses, and position the spheres in the image according to the screened contours.
The sphere positioning system in the image of the embodiment preprocesses the shot image to obtain a binary image, extracts the contour of a connected domain from the obtained binary image, and obtains a contour set to be screened; traversing the contour set, and filtering out non-circular contours which do not meet requirements based on the geometric characteristics of circles; and finally, by solving the fitting ellipses of the rest outlines, screening out the outlines representing the corresponding circles of the spheres in the image according to the eccentricity of the contour fitting ellipses, and further positioning the spheres in the image according to the screened outlines.
In the sphere positioning system in the image, the contour is extracted from the preprocessed binary image, and the non-circular contour is excluded by using the geometric characteristics of the circle, so that in the subsequent operation of fitting the contour with an ellipse, the fitting ellipse operation on the non-circular contour and other irrelevant contours can be avoided, the operation amount is reduced, and the operation cost is reduced. Therefore, the system for positioning the sphere in the image can reduce the calculation amount and reduce the memory consumption.
The method and system for positioning the sphere in the image provided by the invention are described in detail above. The principles and embodiments of the present invention are explained herein using specific examples, which are presented only to assist in understanding the method and its core concepts. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.

Claims (7)

1. A method for positioning a sphere in an image, wherein the sphere set in a scene is a solid sphere, comprising:
extracting the outline of a connected domain from a binary image obtained by preprocessing a shot image to obtain an outline set;
traversing the contour set, and excluding contours of which the contour perimeter is smaller than a first preset value;
traversing the residual contour, and excluding the contour which does not meet a first preset condition, wherein the first preset condition is that the tangent value and the cotangent value of an included angle between the diagonal line of the minimum circumscribed rectangle of the contour and one side are both in a first preset range, and the first preset range is a deviation range taking 1 as a base value;
traversing the residual contours, and excluding contours which do not meet a second preset condition, wherein the second preset condition is that the Euclidean distance between the center point of the minimum circumscribed circle of the contours and the center point of the minimum circumscribed rectangle is within a second preset range;
and traversing the residual contours, solving fitting ellipses of the residual contours, screening out the contours representing the corresponding circles of the spheres in the image according to the eccentricity of the fitting ellipses, and positioning the spheres in the image according to the screened contours.
2. The method according to claim 1, wherein the first preset value is C0,C02 pi r + δ, where r denotes the radius of the smallest circle recognizable in the scene image and δ denotes the error value.
3. The method of claim 1, wherein the minimum bounding rectangle of the outline is the minimum bounding rectangle along the horizontal direction of the image.
4. The method for positioning a sphere in an image according to claim 1, wherein the screening out the contour of the corresponding circle in the image characterizing the sphere according to the eccentricity of the fitted ellipse comprises:
and screening out the contour of the fitting ellipse with the eccentricity larger than the second preset value as the contour of the corresponding circle of the representative sphere in the image.
5. The method of claim 1, wherein the pre-processing the captured image comprises:
converting the color space of the shot image from an RGB color mode to an HSV color mode to obtain an S-channel image, wherein the color of a sphere arranged in a scene is a pure color which is obviously contrasted with white;
and carrying out binarization processing on the obtained image to obtain a binarized image which is distinguished by a spherical area and a background area.
6. The method according to claim 5, further comprising, after the binarizing processing on the obtained image:
and performing morphological opening operation processing on the image after the binarization processing.
7. A system for locating a sphere in an image, wherein the sphere disposed in a scene is a solid sphere, comprising:
the contour extraction module is used for extracting the contour of the connected domain from a binary image obtained by preprocessing a shot image to obtain a contour set;
the first contour screening module is used for traversing the contour set and excluding contours of which the contour perimeter is smaller than a first preset value;
the second contour screening module is used for traversing the residual contours and excluding contours which do not meet a first preset condition, wherein the first preset condition is that a tangent value and a cotangent value of an included angle between a diagonal line of a minimum external rectangle of the contour and one side are both within a first preset range, and the first preset range is a deviation range taking 1 as a basic value;
the third contour screening module is used for traversing the residual contours and excluding contours which do not meet a second preset condition, wherein the second preset condition is that the Euclidean distance between the central point of the minimum circumscribed circle of the contour and the central point of the minimum circumscribed rectangle is within a second preset range;
and the positioning module is used for traversing the residual contours, solving the fitting ellipses of the residual contours, screening out the contours representing the corresponding circles of the spheres in the image according to the eccentricity of the fitting ellipses, and positioning the spheres in the image according to the screened contours.
CN201710173876.XA 2017-03-22 2017-03-22 Method and system for positioning sphere in image Expired - Fee Related CN106952307B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710173876.XA CN106952307B (en) 2017-03-22 2017-03-22 Method and system for positioning sphere in image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710173876.XA CN106952307B (en) 2017-03-22 2017-03-22 Method and system for positioning sphere in image

Publications (2)

Publication Number Publication Date
CN106952307A CN106952307A (en) 2017-07-14
CN106952307B true CN106952307B (en) 2020-01-07

Family

ID=59473403

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710173876.XA Expired - Fee Related CN106952307B (en) 2017-03-22 2017-03-22 Method and system for positioning sphere in image

Country Status (1)

Country Link
CN (1) CN106952307B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107705297B (en) * 2017-09-18 2020-05-22 华南理工大学 Threshold segmentation detection method for circular hole of flexible circuit board
CN108090486B (en) * 2017-12-28 2020-06-09 深圳市超级视觉科技有限公司 Image processing method and device in billiard game
CN109816675A (en) * 2018-12-28 2019-05-28 歌尔股份有限公司 Detection method, detection device and the storage medium of object
CN111310573B (en) * 2020-01-17 2021-08-10 厦门欧易奇机器人有限公司 Method for identifying pressing plate in image of protection screen cabinet
CN112686840A (en) * 2020-12-16 2021-04-20 广州大学 Method, system and device for detecting straw on surface of beverage packaging box and storage medium
CN113284160B (en) * 2021-04-23 2024-03-12 北京天智航医疗科技股份有限公司 Method, device and equipment for identifying surgical navigation mark beads

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102034101A (en) * 2010-10-22 2011-04-27 广东工业大学 Method for quickly positioning circular mark in PCB visual detection
CN102915535A (en) * 2012-08-23 2013-02-06 深圳大学 Method and system for correcting circle center deviation of round mark points during camera projection transformation
CN103793712A (en) * 2014-02-19 2014-05-14 华中科技大学 Image recognition method and system based on edge geometric features
CN105021127A (en) * 2015-06-25 2015-11-04 哈尔滨工业大学 Surface mounting machine reference camera calibration method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102034101A (en) * 2010-10-22 2011-04-27 广东工业大学 Method for quickly positioning circular mark in PCB visual detection
CN102915535A (en) * 2012-08-23 2013-02-06 深圳大学 Method and system for correcting circle center deviation of round mark points during camera projection transformation
CN103793712A (en) * 2014-02-19 2014-05-14 华中科技大学 Image recognition method and system based on edge geometric features
CN105021127A (en) * 2015-06-25 2015-11-04 哈尔滨工业大学 Surface mounting machine reference camera calibration method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
自然环境下圆形禁令交通标志检测;李迎松 等;《武汉大学学报· 信息科学版》;20161231;第42卷(第12期);第2节 *

Also Published As

Publication number Publication date
CN106952307A (en) 2017-07-14

Similar Documents

Publication Publication Date Title
CN106952307B (en) Method and system for positioning sphere in image
CN111243032B (en) Full-automatic detection method for checkerboard corner points
Yu et al. A novel license plate location method based on wavelet transform and EMD analysis
WO2018209941A1 (en) High-density circuit board circular hole sub-pixel detection method based on gaussian fitting
CN111612781A (en) Screen defect detection method and device and head-mounted display equipment
WO2015070723A1 (en) Eye image processing method and apparatus
CN106709500B (en) Image feature matching method
CN109993161B (en) Text image rotation correction method and system
WO2017088637A1 (en) Method and apparatus for locating image edge in natural background
CN110211110B (en) Component size detection method and system and terminal equipment
CN111832659B (en) Laser marking system and method based on feature point extraction algorithm detection
CN107895375A (en) The complicated Road extracting method of view-based access control model multiple features
CN110414308B (en) Target identification method for dynamic foreign matters on power transmission line
CN110807807B (en) Monocular vision target positioning pattern, method, device and equipment
CN110569857A (en) image contour corner detection method based on centroid distance calculation
CN111695373B (en) Zebra stripes positioning method, system, medium and equipment
CN114037992A (en) Instrument reading identification method and device, electronic equipment and storage medium
CN115375629A (en) Method for detecting line defect and extracting defect information in LCD screen
CN115587966A (en) Method and system for detecting whether parts are missing or not under condition of uneven illumination
CN115272664A (en) Instrument panel display method and device, electronic equipment and storage medium
CN116052152A (en) License plate recognition system based on contour detection and deep neural network
CN111260603B (en) Method and device for identifying blade tips of wind generating set
CN111695374B (en) Segmentation method, system, medium and device for zebra stripes in monitoring view angles
CN112580516A (en) Road scene recognition method, device, equipment and storage medium
CN109635679B (en) Real-time target paper positioning and loop line identification method

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
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20200107