CN115482267A - Circle center positioning method, device, equipment and medium based on circular object - Google Patents

Circle center positioning method, device, equipment and medium based on circular object Download PDF

Info

Publication number
CN115482267A
CN115482267A CN202211031429.8A CN202211031429A CN115482267A CN 115482267 A CN115482267 A CN 115482267A CN 202211031429 A CN202211031429 A CN 202211031429A CN 115482267 A CN115482267 A CN 115482267A
Authority
CN
China
Prior art keywords
circle center
sampling
circular
matrix
image
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
CN202211031429.8A
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.)
Kunshanqiu Titanium Photoelectric Technology Co Ltd
Original Assignee
Kunshanqiu Titanium Photoelectric Technology 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 Kunshanqiu Titanium Photoelectric Technology Co Ltd filed Critical Kunshanqiu Titanium Photoelectric Technology Co Ltd
Priority to CN202211031429.8A priority Critical patent/CN115482267A/en
Publication of CN115482267A publication Critical patent/CN115482267A/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/60Analysis of geometric attributes

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 circle center positioning method, a circle center positioning device, circle center positioning equipment and a circle center positioning medium based on a circular object, wherein the method comprises the following steps of: acquiring a circular gray image of the circular object; circularly sampling the circular gray level image to obtain a sampling offset matrix; performing down-sampling and difference pixel statistics on the sampling offset matrix and the circle center calculation area of the circular gray level image, and storing the number of pixels obtained by statistics to a pre-established circle center counting matrix; moving the sampling circle center of the circular sampling in the circle center calculation area according to a set step length, and repeatedly executing the difference pixel counting step until the circle center calculation area is traversed to obtain the circle center counting matrix; and determining the storage position corresponding to the maximum pixel number in the circle center counting matrix as the reference circle center position of the circular object. The invention can solve the technical problems of large computation amount, low precision and the like in the existing circular object positioning scheme.

Description

Circle center positioning method, device, equipment and medium based on circular object
Technical Field
The invention relates to the technical field of image processing, in particular to a circle center positioning method, a circle center positioning device, circle center positioning equipment and a circle center positioning medium based on a circular object.
Background
In the field of image processing and object detection, the detection of circular objects and their positioning is often encountered. Currently, hough transform technology is usually adopted to detect and locate a circular object. Specifically, edge detection of a circular object is performed on a circular object image, and then the circle detection is performed on the detected image by using the Hough transform technology.
However, in practice, it is found that the hough transform technique used in the existing circular object positioning scheme needs to perform positioning calculation on all pixel points of an image, and meanwhile, accumulation voting needs to be performed on each pixel point, so that the circle center and the radius of the circular object are determined, a large amount of calculation exists, and a plurality of circle centers and radii easily appear in an accumulation voting result, which results in low positioning accuracy. Therefore, it is highly desirable to provide a better circle center positioning scheme based on a circular object.
Disclosure of Invention
The embodiment of the application provides a circle center positioning method, a circle center positioning device, circle center positioning equipment and a circle center positioning medium based on a circular object, and solves the technical problems of large calculation amount, low precision and the like in the conventional circular object positioning scheme.
In one aspect, the present application provides a circle center positioning method based on a circular object through an embodiment of the present application, where the method includes the following steps:
s1, acquiring a circular gray image of the circular object;
s2, circularly sampling the circular gray level image to obtain a sampling offset matrix;
s3, performing down-sampling and difference pixel statistics on the sampling offset matrix and the circle center calculation area of the circular gray level image, and storing the number of pixels obtained through statistics to a pre-established circle center counting matrix;
s4, moving the sampling circle center of the circular sampling in the circle center calculation area according to a set step length, and repeatedly executing the step S3 until the circle center calculation area is traversed to obtain a circle center counting matrix;
and S5, determining the storage position corresponding to the maximum pixel number in the circle center counting matrix as the reference circle center position of the circular object.
Optionally, the method further comprises:
and increasing the size of the sampling offset matrix, updating the circle center calculation area according to the reference circle center position, and repeatedly executing the steps S2-S5 to obtain the final circle center position of the circular object.
Optionally, the step S2 includes:
according to a preset sampling radius, carrying out plane sampling on the circular gray level image along the radius direction and the circumferential direction to obtain a plurality of plane sampling points;
and performing polar coordinate conversion on the plurality of plane sampling points to obtain the sampling offset matrix, wherein the sampling offset matrix comprises coordinates of the plurality of sampling points.
Optionally, the down-sampling and the difference pixel statistics of the sampling offset matrix and the circle center calculation region of the circular gray-scale image include:
determining a circle center calculation area of the circular gray-scale image according to a preset sampling radius;
according to the circle center calculation area and the sampling offset matrix, performing down-sampling on the circular gray level image to obtain a down-sampled image;
and counting the number of pixels, of which the absolute value of the difference of adjacent rows is greater than the absolute value of the difference of adjacent columns, in the down-sampled image based on the pixel value of each pixel point in the down-sampled image.
Optionally, the down-sampling the circular gray-scale image according to the circle center calculation region and the sampling offset matrix to obtain a down-sampled image includes:
correcting the coordinates of each sampling point in the sampling offset matrix according to the selected point in the circle center calculation region to obtain a sampling correction matrix;
and performing down-sampling on the circular gray level image according to the sampling correction matrix to obtain the down-sampled image.
Optionally, the storing the counted number of pixels to a pre-established circle center counting matrix includes:
a circle center counting matrix is created in advance, and the circle center counting matrix and the circular gray-scale image have the same size;
and storing the counted number of the pixels to a coordinate position corresponding to the selected point in the circle center counting matrix.
Optionally, the step S4 includes:
moving the sampling circle center of the circular sampling line by line according to a first step length from the reference starting point of the circle center calculation area;
if the movement exceeds the boundary point of the circle center calculation area, the target line is moved downwards according to a second step length, and the target line is continuously moved line by line according to the first step length;
and after each movement, repeating the step S3 until the circle center calculation area is moved and traversed, and obtaining the circle center counting matrix.
On the other hand, the present application provides a circle center positioning device based on a circular object through an embodiment of the present application, the device includes an obtaining module, a sampling module, a processing module and a determining module, wherein:
the acquisition module is used for acquiring a circular gray image of the circular object;
the sampling module is used for circularly sampling the circular gray level image to obtain a sampling offset matrix;
the processing module is used for performing down-sampling and difference pixel statistics on the sampling offset matrix and the circle center calculation area of the circular gray level image, and storing the number of pixels obtained by statistics to a pre-established circle center counting matrix;
the processing module is further configured to move the sampling circle center of the circular sampling in the circle center calculation area according to a set step length, and repeatedly execute the steps executed by the processing module until the circle center calculation area is traversed, so as to obtain the circle center counting matrix;
the determining module is configured to determine a storage location corresponding to the maximum number of pixels in the circle center counting matrix as a reference circle center location of the circular object.
For the content that is not introduced or not described in the embodiments of the present invention, reference may be made to the related descriptions in the foregoing method embodiments, and details are not repeated here.
On the other hand, the present application provides a terminal device according to an embodiment of the present application, where the terminal device includes: a processor, a memory, a communication interface, and a bus; the processor, the memory and the communication interface are connected through the bus and complete mutual communication; the memory stores executable program code; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, for executing the circle center positioning method based on the circular object as described above.
On the other hand, the present application provides a computer-readable storage medium by an embodiment of the present application, where the computer-readable storage medium stores a program, and when the program runs on a terminal device, the method for locating the circle center based on a circular object as described above is executed.
One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: the method comprises the steps of obtaining a circular gray image of the circular object; circularly sampling the circular gray level image to obtain a sampling offset matrix; performing down-sampling and difference pixel statistics on the sampling offset matrix and the circle center calculation area of the circular gray-scale image, and storing the number of pixels obtained by the statistics to a pre-established circle center counting matrix; moving the sampling circle center of the circular sampling in the circle center calculation area according to a set step length, and repeatedly executing the steps of down-sampling and difference pixel statistics until the circle center calculation area is traversed to obtain a circle center counting matrix; and determining the storage position corresponding to the maximum pixel number in the circle center counting matrix as the reference circle center position of the circular object. In the scheme, the pixel change condition of the circular object is considered, the difference pixel statistics is carried out on the circular gray level image, and then the circle center position of the circular object in the image is detected quickly and accurately, so that the convenience and the accuracy of circle center position positioning are realized, and the technical problems of large operation amount, low precision and the like in the existing circular object positioning scheme are synchronously solved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a circle center positioning method based on a circular object according to an embodiment of the present disclosure.
Fig. 2 is a schematic diagram of a circular gray scale image according to an embodiment of the present application.
Fig. 3 is a schematic view of a circular sampling scenario provided in an embodiment of the present application.
Fig. 4 is a distribution diagram of a sampling offset matrix according to an embodiment of the present application.
Fig. 5 is a schematic diagram of a circle calculation region in a circular gray scale image according to an embodiment of the present application.
Fig. 6 and 7 are schematic diagrams of two possible down-sampled images provided by the embodiment of the present application.
Fig. 8 is a schematic diagram of a count matrix image corresponding to a circle center count matrix according to an embodiment of the application.
Fig. 9 is a schematic structural diagram of a circle center positioning device based on a circular object according to an embodiment of the present application.
Fig. 10 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides a circle center positioning method, a circle center positioning device, circle center positioning equipment and a circle center positioning medium based on a circular object, and solves the technical problems of large calculation amount, low precision and the like in the conventional circular object positioning scheme.
In order to solve the technical problems, the general idea of the embodiment of the application is as follows:
the embodiment of the application provides a circle center positioning method based on a circular object, which comprises the following steps:
s1, acquiring a circular gray image of the circular object;
s2, circularly sampling the circular gray level image to obtain a sampling offset matrix;
s3, performing down-sampling and difference pixel statistics on the sampling offset matrix and the circle center calculation area of the circular gray-scale image, and storing the number of pixels obtained through statistics to a pre-established circle center counting matrix;
s4, moving the sampling circle center of the circular sampling in the circle center calculation area according to a set step length, and repeatedly executing the step S3 until the circle center calculation area is traversed to obtain a circle center counting matrix;
and S5, determining the storage position corresponding to the maximum pixel number in the circle center counting matrix as the reference circle center position of the circular object.
In order to better understand the technical scheme, the technical scheme is described in detail in the following with reference to the attached drawings of the specification and specific embodiments.
First, it is noted that the term "and/or" appearing herein is merely an associative relationship that describes an associated object, meaning that three relationships may exist, e.g., a and/or B, may represent: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
Fig. 1 is a schematic flow chart of a circle center positioning method based on a circular object according to an embodiment of the present application. The method as shown in fig. 1 comprises the following implementation steps:
s1, acquiring a circular gray image of the circular object.
The circular grayscale image may be a filtered grayscale image. Specifically, the present application may first acquire an initial image of the circular object, where the initial image includes an imaging region of the circular object. In the application, the initial image may be a binarized black-and-white image, a multichannel color image, or a multichannel grayscale mode image, and therefore, in order to simplify subsequent positioning calculation and increase the operation speed, the application may perform grayscale processing on the initial image to convert the initial image into a single-channel grayscale processed image. Finally, in order to suppress noise interference in the image, the present application may perform filtering processing on the gray-scale processed image to obtain the circular gray-scale image. The specific implementation of the filtering process is not limited in this application, and examples of the filtering process include gaussian filtering, median filtering, and the like.
Therefore, in the present application, the initial image of the imaging region including the circular object may generate the circular gray image after being subjected to the gray processing and the filtering processing. The imaged area of the circular object is also included in the circular gray-scale image.
The size of the circular gray image is not limited in this application, because the circular gray image only needs to include the imaging area of the circular object, that is, the size of the circular gray image only needs to be larger than the imaging area of the circular object, and the imaging area of the circular object is placed in the circular gray image. For example, the size of the circular gray image is H × W, H is the length of the circular gray image, and W is the width of the circular gray image.
For example, please refer to fig. 2, which is a schematic diagram of a circular gray scale image of a possible circular object according to an embodiment of the present disclosure. If fig. 2 illustrates that the circular object is a circular mechanical workpiece, and the mechanical circular workpiece is composed of a plurality of concentric circular workpieces, the circular grayscale image shown in fig. 2 also includes a plurality of concentric circles.
And S2, circularly sampling the circular gray level image to obtain a sampling offset matrix.
The present application considers that in a circular gray scale image, the pixel values (also referred to as gray scale values) of the pixel points in the radial direction of the circle are obviously changed, and the pixel values of the pixel points in the circumferential direction are basically unchanged. Therefore, the circular gray-scale image can be circularly sampled in a circular distribution mode to obtain a corresponding sampling offset matrix.
In a specific embodiment, the method can perform plane sampling on the circular gray-scale image along a radius direction and a circumferential direction according to a preset sampling radius to obtain a plurality of plane sampling points in a plane coordinate system. The number of the plurality of plane sampling points is not limited in the application, and the coordinates of the plurality of plane sampling points are distributed in a circle relative to the circle center position of the circular sampling. The sampling radius is set by the system in a self-defined mode, for example, the sampling radius of the sampling circle can be set to be R. The number of sampling points in the radial direction and the circumferential direction is not limited in this application.
Specifically, for example, the present application may perform plane sampling on the circular grayscale image according to a sampling radius R of a sampling circle, where the number of sampling points in the radial direction is N, and the number of sampling points in the circumferential direction is M. At the moment, the sampling precision in the radial direction is R/N, and the sampling precision in the circumferential direction is 360/M. And M and N are positive integers set by a system in a self-defined way. Generally, the larger the values of M and N are, the lower the calculation efficiency of the scheme of the application is, but the higher the calculation accuracy is.
Please refer to fig. 3, which illustrates a schematic diagram of a circular sampling scenario. As shown in fig. 3, the present application performs plane sampling with corresponding sampling points along the radial direction OW and the circumferential direction WH, respectively, so as to obtain a plurality of plane sampling points in a plane coordinate system.
After obtaining a plurality of the plane sampling points, the method can convert the plurality of the plane sampling points in the plane coordinate system into the polar coordinate system so as to obtain the corresponding sampling offset matrix. Please refer to fig. 4, which shows a distribution diagram of a possible sampling offset matrix. The size of the sample offset matrix as shown in fig. 4 is M × N, where M is the number of columns of the sample offset matrix and N is the number of rows of the sample offset matrix. The element coordinate (also called the coordinate of the sampling point or the pixel point) of the mth row and the mth column in the sampling offset matrix can be expressed as P (X) m ,Y n ) Specifically, the following formula (1) shows:
Figure BDA0003817294890000081
Figure BDA0003817294890000082
s3, performing down-sampling and difference pixel statistics on the sampling offset matrix and the circle center calculation area of the circular gray-scale image, and storing the number of pixels obtained through statistics to a pre-established circle center counting matrix.
In a specific embodiment, the center calculation region of the circular gray image may be determined according to the preset sampling radius. Specifically, the circle center position range of the circular sampling, namely the circle center calculation area, can be determined according to the sampling radius R and the size H × W of the circular gray image. The reference starting point of the center calculation region is (R, R), and the shape and size of the center calculation region may not be limited, for example, the center calculation region may be a rectangular region of (H-2R) × (W-2R).
For example, please refer to fig. 5, which shows a schematic diagram of a possible circle center calculation area. The reference starting point of the circle center calculation region shown in fig. 5 is the upper left corner D (R, R) of the circle center calculation region. And the circle center calculation area is positioned in the central area of the circular gray-scale image and is represented as a rectangular area framed by a width W-2R and a length H-2R, and the figure is represented as an area B. The other regions of the circular gray-scale image except the center calculation region can be represented as a region a.
Then, the circular gray-scale image can be subjected to down-sampling according to the circle center calculation area and the sampling offset matrix to obtain a down-sampled image. Specifically, the coordinates of each sampling point in the sampling offset matrix can be corrected according to the selected point in the circle center calculation region, so that a sampling correction matrix is obtained. And then, according to the sampling correction matrix, performing down-sampling on the circular gray level image to obtain the down-sampled image.
In a specific implementation, any pixel point may be selected from the circular calculation region as a selected point of the circular calculation region, and a coordinate of the selected point may be represented as Q (x, y). The coordinates of each sampling point in the sampling offset matrix can be modified by the selected point, and specifically, the coordinates of the selected point and the coordinates of each sampling point in the sampling offset matrix can be superimposed to obtain the corresponding sampling correction matrix. Taking the correction of the coordinates of the sampling point in the mth column of the nth row in the sampling offset matrix as an example, the correction is as shown in the following formula (2):
P'=P+Q
X' m =X m +x
Y' n =Y n + y formula (2)
Wherein P 'represents a sampling point P' (X ') at the nth row and mth column in the sampling correction matrix' m ,Y' n ) Representing the coordinates of P'. P represents a sampling point of an m-th column of an n-th row in the sampling offset matrix, P (X) m ,Y n ) Representing the coordinates of P. (x, y) represents the coordinates of the selected point.
After the sampling correction matrix is obtained, the corresponding pixel values at the coordinate position can be obtained from the circular gray-scale image according to the coordinate (position) of each sampling point in the sampling correction matrix, and then the pixel values are combined together according to the same arrangement sequence as that of each sampling point in the sampling correction matrix, so that the down-sampling image is obtained.
For example, please refer to fig. 6 and fig. 7, which are schematic diagrams of two possible down-sampled images provided by the embodiment of the present application. The down-sampled image is derived from the coordinates (positions) of each sampling point in the sampling correction matrix and the pixel values of each sampling point, so that the down-sampled image can be regarded as the expansion of the circular gray-scale image under a polar coordinate system, the circular figure can be converted into a figure similar to a rectangle after the expansion under the polar coordinate system, and each sampling point just can correspond to the sampling correction matrix.
Fig. 6 specifically shows a downsampled image when the sampling circle center does not coincide with the true circle center of the circular object, and each circular contour of the circular object in the downsampled image is in a curved state in a polar coordinate system as shown in the figure.
Fig. 7 specifically shows the downsampled image when the sampling circle center coincides with the true circle center of the circular object, and as shown in the figure, each circular contour of the circular object in the downsampled image is in an approximately linear state in a polar coordinate system.
Then, the present application may utilize a counting tool, such as a counter, to count the number of pixels in the downsampled image where the absolute value of the difference between adjacent rows is greater than the absolute value of the difference between adjacent columns based on the pixel value of each pixel point in the downsampled image. Specifically, the present application may sequentially traverse each pixel point in the downsampled image from the 2 nd row and the 2 nd column in the downsampled image, and calculate an absolute value of a pixel value difference between the pixel point and a left adjacent pixel point of the pixel point, that is, calculate an absolute value of an adjacent row difference, which may be denoted as Diff _ H. Similarly, the absolute value of the pixel value difference between the pixel and the pixel above the pixel is calculated, i.e. the absolute value of the difference between adjacent columns is calculated, which can be expressed as Diff _ V. And further comparing the sizes of Diff _ H and Diff _ V, if Diff _ H is larger than Diff _ V, adding 1 to the number of counters, otherwise, the number of counters is not changed. In other words, the present application needs to count the number of pixels in the downsampled image whose absolute value of the difference between adjacent rows is greater than that between adjacent columns.
For example, the following table 1 shows pixel values of some pixel points in the down-sampled image.
TABLE 1
60 65 68
70 73 79
74 74 74
Taking the pixel with the pixel value of 73 in the above table 1 as an example, the column difference absolute value Diff _ V between the pixel with the pixel value of 65 above and the pixel with the pixel value of 8 above is 8; the absolute value of the line difference Diff _ H between it and the pixel whose left pixel value is 70 is 3. Since 8 is greater than 3, the number of counters may be increased by 1.
Finally, after the pixel number is obtained through statistics, the pixel number can be stored in a pre-established circle center counting matrix, and specifically can be stored in a coordinate position (x, y) corresponding to the selected point in the circle center counting matrix. The circle center counting matrix is a counting storage matrix created by the system in advance, and the default of the numerical value of each element in the matrix is set to 0. The circle center counting matrix has the same size as the circular gray scale image, for example, the size of the circle center counting matrix is also H × W.
And S4, moving the sampling circle center of the circular sampling in the circle center calculation area according to a set step length, and repeatedly executing the step S3 until the circle center calculation area is traversed to obtain the circle center counting matrix.
The method can start from a reference starting point of the circle center calculation area, and the sampling circle center of the circular sampling is moved line by line according to a first step length in the circle center calculation area. When the movement exceeds the boundary point of the circle center calculation area, the method can move downwards to a target line according to a second step length, and the target line continues to move line by line according to the first step length. And after each movement, repeating the step S3 until the whole circle center calculation area is traversed to obtain the circle center counting matrix. The first step length and the second step length can be set step lengths set by a system in a user-defined mode, and the first step length and the second step length can be the same or different and are not limited in the application.
Specifically, for example, the present application may sequentially move the sampling circle center of the sampling circle from the reference starting point of the circle center calculation region, i.e., the upper left corner (R, R), and the lower right corner line by line in a "Z" pattern. In the line-by-line moving process, S pixel points are moved every time, when the movement exceeds the right boundary of the circle center calculation area, the S pixel points (namely S lines) can be jumped downwards, and the target line to which the jumping is performed is continuously moved from left to right. In each movement, the above step S3 may be executed, and after all the movements are completed, the circle center counting matrix H × W may be obtained.
And S5, determining the storage position corresponding to the maximum pixel number in the circle center counting matrix as the reference circle center position of the circular object.
The coordinate position where the maximum pixel number is located can be found from the circle center counting matrix, and the coordinate position is determined as the reference circle center position of the circular object, which can be represented as C 1 (X 1 ,Y 1 )。
For example, please refer to fig. 8, which illustrates a schematic diagram of a count matrix image corresponding to a possible circle center count matrix. The coordinate position of the brightest pixel point in the counting matrix image shown in fig. 8 is the coordinate position where the maximum pixel number in the circle center counting matrix is located, that is, the reference circle center position of the circular object.
In an optional embodiment, the size of the sampling offset matrix may be increased, the reference circle center position may be used as a reference center of the circle center calculation region, and the circle center calculation region may be updated. The shape and size of the region calculated from the center of the circle are not limited in the present application, and may be, for example, a rectangular region with a width and a height of 2S. And then, repeatedly executing the steps S2-S5 to obtain the final circle center position of the circular object.
In a specific implementation, the size of the sampling offset matrix can be synchronously increased, specifically, the values of M and N can be increased, and N is generally less than or equal to R. At the same time using the reference circle center position C 1 Is centered on (X) 1 -S,Y 1 And S) taking a rectangular area with the reference starting point (upper left corner), width and height of the circle center calculation area of 2S as a new circle center calculation area, and repeatedly executing the steps S2-S5 to obtain a new circle center counting matrix. In step S4, the number of pixels moved each time (i.e. step length) can be changed according to actual requirementsFor example, S may be modified to 1, etc. After obtaining the new circle center counting matrix, the present application also determines the coordinate position of the maximum pixel number in the circle center counting matrix as the final circle center position under the condition of the accuracy S, which can be represented as C 0 (X 0 ,Y 0 )。
In specific implementation, the circular gray image can be directly expanded in a polar coordinate system, pixel values of all pixel points are directly traversed, gradient pixels among all rows of pixel points are calculated, and therefore the final circle center position of the circular object is determined.
In specific implementation, the circular gray-scale image can be directly unfolded in a polar coordinate system, then pixel values of pixel points in a predetermined area are traversed according to the predetermined area or a set step length, gradient pixels among the pixel points in the predetermined area are calculated, the range of the circle center of the circular pattern is determined, the position of the circle center of the circular pattern is approximated by continuously adjusting the size of the predetermined area or the traversed step length, and therefore the final circle center position of the circular object is determined.
In the specific implementation, the circular gray-scale image can be directly unfolded under a polar coordinate system, and the offset of the two coordinate systems can be calculated according to the coordinate conversion relation between the polar coordinate system and the plane coordinate system, so that the coordinates of each sampling point are determined, the position of each sampling point in a sampling offset matrix is further determined, then points in the sampling offset matrix and corresponding pixel values are traversed, and the final circle center position of the circular object is determined according to the distribution of the pixel values. By implementing the embodiment of the application, the application acquires the circular gray image of the circular object; circularly sampling the circular gray level image to obtain a sampling offset matrix; performing down-sampling and difference pixel statistics on the sampling offset matrix and the circle center calculation area of the circular gray level image, and storing the number of pixels obtained by statistics to a pre-established circle center counting matrix; moving the sampling circle center of the circular sampling in the circle center calculation area according to a set step length, and repeatedly executing the steps of down-sampling and difference pixel statistics until the circle center calculation area is traversed to obtain a circle center counting matrix; and determining the storage position corresponding to the maximum pixel number in the circle center counting matrix as the reference circle center position of the circular object. In the scheme, the pixel change condition of the circular object is considered, the difference pixel statistics is carried out on the circular gray level image, and then the circle center position of the circular object in the image is detected quickly and accurately, so that the convenience and the accuracy of circle center position positioning are realized, and the technical problems of large calculation amount, low precision and the like existing in the conventional circular object positioning scheme are synchronously solved.
Based on the same inventive concept, another embodiment of the present application provides a device and a terminal device corresponding to the method for positioning a circle center based on a circular object in the embodiment of the present application.
Fig. 9 is a schematic structural diagram of a circle center positioning device based on a circular object according to an embodiment of the present application. The apparatus 90 shown in fig. 9 comprises an obtaining module 901, a sampling module 902, a processing module 903 and a determining module 904, wherein:
the acquiring module 901 is configured to acquire a circular gray image of the circular object;
the sampling module 902 is configured to perform circular sampling on the circular grayscale image to obtain a sampling offset matrix;
the processing module 903 is configured to perform downsampling and difference pixel statistics on the sampling offset matrix and the circle center calculation area of the circular grayscale image, and store the number of pixels obtained through the statistics in a pre-established circle center counting matrix;
the processing module 903 is further configured to move the sampling circle center of the circular sample in the circle center calculation area according to a set step length, and repeatedly execute the steps executed by the processing module until the circle center calculation area is traversed, so as to obtain the circle center counting matrix;
the determining module 904 is configured to determine a storage location corresponding to the maximum number of pixels in the circle center counting matrix as a reference circle center location of the circular object.
Optionally, the processing module 903 is further configured to:
and increasing the size of the sampling offset matrix, updating the circle center calculation area according to the reference circle center position, and repeatedly executing the steps S2-S5 to obtain the final circle center position of the circular object.
Optionally, the sampling module 902 is specifically configured to:
according to a preset sampling radius, carrying out plane sampling on the circular gray level image along the radius direction and the circumferential direction to obtain a plurality of plane sampling points;
and performing polar coordinate conversion on the plurality of plane sampling points to obtain the sampling offset matrix, wherein the sampling offset matrix comprises coordinates of the plurality of sampling points.
Optionally, the processing module 903 is specifically configured to:
determining a circle center calculation area of the circular gray-scale image according to a preset sampling radius;
according to the circle center calculation area and the sampling offset matrix, performing down-sampling on the circular gray-scale image to obtain a down-sampled image;
and counting the number of pixels, of which the absolute value of the difference of adjacent rows is greater than the absolute value of the difference of adjacent columns, in the down-sampled image based on the pixel value of each pixel point in the down-sampled image.
Optionally, the processing module 903 is specifically configured to:
correcting the coordinates of each sampling point in the sampling offset matrix according to the selected point in the circle center calculation region to obtain a sampling correction matrix;
and performing down-sampling on the circular gray-scale image according to the sampling correction matrix to obtain the down-sampled image.
Optionally, the processing module 903 is specifically configured to:
a circle center counting matrix is created in advance, and the circle center counting matrix and the circular gray-scale image have the same size;
and storing the counted pixel number to a coordinate position corresponding to the selected point in the circle center counting matrix.
Optionally, the determining module 904 is specifically configured to:
starting from the reference starting point of the circle center calculation area, moving the sampling circle center of the circular sampling line by line according to a first step length;
if the movement exceeds the boundary point of the circle center calculation area, the target line is moved downwards according to a second step length, and the target line is continuously moved line by line according to the first step length;
and after each movement, repeatedly executing the step S3 until the circle center calculation area is traversed to obtain the circle center counting matrix.
For the content that is not introduced or described in the embodiments of the present application, reference may be made to the related descriptions in the foregoing method embodiments, and details are not repeated here.
Please refer to fig. 10, which is a schematic structural diagram of a terminal device according to an embodiment of the present application. The terminal device 10 shown in fig. 10 includes: at least one processor 101, a communication interface 102, a user interface 103, and a memory 104, wherein the processor 101, the communication interface 102, the user interface 103, and the memory 104 may be connected by a bus or other means, and the embodiment of the present invention is exemplified by being connected by the bus 105. Wherein, the first and the second end of the pipe are connected with each other,
processor 101 may be a general-purpose processor, such as a Central Processing Unit (CPU).
The communication interface 102 may be a wired interface (e.g., an ethernet interface) or a wireless interface (e.g., a cellular network interface or using a wireless local area network interface) for communicating with other terminals or websites. In the embodiment of the present invention, the communication interface 102 is specifically configured to acquire information such as an image.
The user interface 103 may be a touch panel, including a touch screen and a touch screen, for detecting an operation command on the touch panel, and the user interface 103 may also be a physical button or a mouse. The user interface 103 may also be a display screen for outputting, displaying images or data.
The Memory 104 may include Volatile Memory (Volatile Memory), such as Random Access Memory (RAM); the Memory may also include a Non-Volatile Memory (Non-Volatile Memory), such as a Read-Only Memory (ROM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, HDD), or a Solid-State Drive (SSD); the memory 104 may also comprise a combination of the above types of memory. The memory 104 is used for storing a set of program codes, and the processor 101 is used for calling the program codes stored in the memory 104 and executing the following operation steps:
s1, acquiring a circular gray image of the circular object;
s2, circularly sampling the circular gray level image to obtain a sampling offset matrix;
s3, performing down-sampling and difference pixel statistics on the sampling offset matrix and the circle center calculation area of the circular gray-scale image, and storing the number of pixels obtained through statistics to a pre-established circle center counting matrix;
s4, moving the sampling circle center of the circular sampling in the circle center calculation area according to a set step length, and repeatedly executing the step S3 until the circle center calculation area is traversed to obtain a circle center counting matrix;
and S5, determining the storage position corresponding to the maximum pixel number in the circle center counting matrix as the reference circle center position of the circular object.
Optionally, the processor 101 is further configured to:
and increasing the size of the sampling offset matrix, updating the circle center calculation area according to the reference circle center position, and repeatedly executing the steps S2-S5 to obtain the final circle center position of the circular object.
Optionally, the step S2 includes:
according to a preset sampling radius, performing plane sampling on the circular gray level image along the radius direction and the circumferential direction to obtain a plurality of plane sampling points;
and performing polar coordinate conversion on the plurality of plane sampling points to obtain the sampling offset matrix, wherein the sampling offset matrix comprises coordinates of the plurality of sampling points.
Optionally, the down-sampling and difference pixel statistics on the sampling offset matrix and the circle center calculation region of the circular gray scale image include:
determining a circle center calculation area of the circular gray-scale image according to a preset sampling radius;
according to the circle center calculation area and the sampling offset matrix, performing down-sampling on the circular gray level image to obtain a down-sampled image;
and counting the number of pixels, of which the absolute value of the difference of adjacent rows is greater than the absolute value of the difference of adjacent columns, in the down-sampled image based on the pixel value of each pixel point in the down-sampled image.
Optionally, the down-sampling the circular gray-scale image according to the circle center calculation region and the sampling offset matrix to obtain a down-sampled image includes:
correcting the coordinates of each sampling point in the sampling offset matrix according to the selected point in the circle center calculation region to obtain a sampling correction matrix;
and performing down-sampling on the circular gray level image according to the sampling correction matrix to obtain the down-sampled image.
Optionally, the storing the counted number of pixels to a pre-established circle center counting matrix includes:
a circle center counting matrix is created in advance, and the circle center counting matrix and the circular gray level image have the same size;
and storing the counted pixel number to a coordinate position corresponding to the selected point in the circle center counting matrix.
Optionally, the step S4 includes:
moving the sampling circle center of the circular sampling line by line according to a first step length from the reference starting point of the circle center calculation area;
if the movement exceeds the boundary point of the circle center calculation area, the target line is moved downwards according to a second step length, and the target line is continuously moved line by line according to the first step length;
and after each movement, repeating the step S3 until the circle center calculation area is moved and traversed, and obtaining the circle center counting matrix.
Since the terminal device described in this embodiment is a terminal device used for implementing the method in this embodiment, based on the method described in this embodiment, a person skilled in the art can know a specific implementation of the terminal device in this embodiment and various variations thereof, so that a detailed description of how to implement the method in this embodiment by the terminal device is not described here. The terminal device adopted by a person skilled in the art to implement the method in the embodiment of the present application is within the scope of the protection intended by the present application.
One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: the method comprises the steps of obtaining a circular gray image of the circular object; circularly sampling the circular gray level image to obtain a sampling offset matrix; performing down-sampling and difference pixel statistics on the sampling offset matrix and the circle center calculation area of the circular gray level image, and storing the number of pixels obtained by statistics to a pre-established circle center counting matrix; moving the sampling circle center of the circular sampling in the circle center calculation area according to a set step length, and repeatedly executing the steps of down-sampling and difference pixel statistics until the circle center calculation area is traversed to obtain a circle center counting matrix; and determining the storage position corresponding to the maximum pixel number in the circle center counting matrix as the reference circle center position of the circular object. In the scheme, the pixel change condition of the circular object is considered, the difference pixel statistics is carried out on the circular gray level image, and then the circle center position of the circular object in the image is detected quickly and accurately, so that the convenience and the accuracy of circle center position positioning are realized, and the technical problems of large calculation amount, low precision and the like existing in the conventional circular object positioning scheme are synchronously solved.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (10)

1. A circle center positioning method based on a circular object is characterized by comprising the following steps:
s1, acquiring a circular gray image of the circular object;
s2, circularly sampling the circular gray level image to obtain a sampling offset matrix;
s3, performing down-sampling and difference pixel statistics on the sampling offset matrix and the circle center calculation area of the circular gray level image, and storing the number of pixels obtained through statistics to a pre-established circle center counting matrix;
s4, moving the sampling circle center of the circular sampling in the circle center calculation area according to a set step length, and repeatedly executing the step S3 until the circle center calculation area is traversed to obtain the circle center counting matrix;
and S5, determining the storage position corresponding to the maximum pixel number in the circle center counting matrix as the reference circle center position of the circular object.
2. The method of claim 1, further comprising:
and increasing the size of the sampling offset matrix, updating the circle center calculation area according to the reference circle center position, and repeatedly executing the steps S2-S5 to obtain the final circle center position of the circular object.
3. The method according to claim 1, wherein the step S2 comprises:
according to a preset sampling radius, performing plane sampling on the circular gray level image along the radius direction and the circumferential direction to obtain a plurality of plane sampling points;
and performing polar coordinate conversion on the plurality of plane sampling points to obtain the sampling offset matrix, wherein the sampling offset matrix comprises coordinates of the plurality of sampling points.
4. The method of claim 1, wherein the down-sampling and difference pixel statistics of the sampling offset matrix and the circle center calculation region of the circular gray scale image comprise:
determining a circle center calculation area of the circular gray-scale image according to a preset sampling radius;
according to the circle center calculation area and the sampling offset matrix, performing down-sampling on the circular gray level image to obtain a down-sampled image;
and counting the number of pixels, of which the absolute value of the difference of adjacent rows is greater than the absolute value of the difference of adjacent columns, in the down-sampled image based on the pixel value of each pixel point in the down-sampled image.
5. The method of claim 4, wherein the down-sampling the circular gray scale image according to the circle center calculation region and the sampling offset matrix to obtain a down-sampled image comprises:
correcting the coordinates of each sampling point in the sampling offset matrix according to the selected point in the circle center calculation region to obtain a sampling correction matrix;
and performing down-sampling on the circular gray level image according to the sampling correction matrix to obtain the down-sampled image.
6. The method of claim 5, wherein storing the counted number of pixels to a pre-established circle center count matrix comprises:
a circle center counting matrix is created in advance, and the circle center counting matrix and the circular gray-scale image have the same size;
and storing the counted pixel number to a coordinate position corresponding to the selected point in the circle center counting matrix.
7. The method according to claim 1, wherein the step S4 comprises:
moving the sampling circle center of the circular sampling line by line according to a first step length from the reference starting point of the circle center calculation area;
if the movement exceeds the boundary point of the circle center calculation area, the target line is moved downwards according to a second step length, and the target line is continuously moved line by line according to the first step length;
and after each movement, repeatedly executing the step S3 until the circle center calculation area is traversed to obtain the circle center counting matrix.
8. A circle center positioning device based on a circular object is characterized by comprising an acquisition module, a sampling module, a processing module and a determination module, wherein:
the acquisition module is used for acquiring a circular gray image of the circular object;
the sampling module is used for circularly sampling the circular gray level image to obtain a sampling offset matrix;
the processing module is used for performing down-sampling and difference pixel statistics on the sampling offset matrix and the circle center calculation area of the circular gray level image, and storing the number of pixels obtained by statistics to a pre-established circle center counting matrix;
the processing module is further configured to move the sampling circle center of the circular sample in the circle center calculation region according to a set step length, and repeatedly execute the steps executed by the processing module until the circle center calculation region is traversed, so as to obtain the circle center counting matrix;
the determining module is configured to determine a storage location corresponding to the maximum number of pixels in the circle center counting matrix as a reference circle center location of the circular object.
9. A terminal device, characterized in that the terminal device comprises: a processor, a memory, a communication interface, and a bus; the processor, the memory and the communication interface are connected through the bus and complete mutual communication; the memory stores executable program code; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the circle center positioning method based on the circular object according to any one of claims 1 to 7.
10. A computer-readable storage medium characterized by storing a program which, when run on a terminal device, executes the circular object based circle center positioning method according to any one of claims 1 to 7.
CN202211031429.8A 2022-08-26 2022-08-26 Circle center positioning method, device, equipment and medium based on circular object Pending CN115482267A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211031429.8A CN115482267A (en) 2022-08-26 2022-08-26 Circle center positioning method, device, equipment and medium based on circular object

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211031429.8A CN115482267A (en) 2022-08-26 2022-08-26 Circle center positioning method, device, equipment and medium based on circular object

Publications (1)

Publication Number Publication Date
CN115482267A true CN115482267A (en) 2022-12-16

Family

ID=84422287

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211031429.8A Pending CN115482267A (en) 2022-08-26 2022-08-26 Circle center positioning method, device, equipment and medium based on circular object

Country Status (1)

Country Link
CN (1) CN115482267A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117817152A (en) * 2024-03-06 2024-04-05 大族激光智能装备(江苏)有限公司 Circle center positioning method, device, storage medium and computer program product

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117817152A (en) * 2024-03-06 2024-04-05 大族激光智能装备(江苏)有限公司 Circle center positioning method, device, storage medium and computer program product

Similar Documents

Publication Publication Date Title
EP3306562B1 (en) Image processing method and device
US20210334574A1 (en) Commodity detection terminal, commodity detection method, system, computer device, and computer readable medium
EP1678659B1 (en) Method and image processing device for analyzing an object contour image, method and image processing device for detecting an object, industrial vision apparatus, smart camera, image display, security system, and computer program product
CN112132907B (en) Camera calibration method and device, electronic equipment and storage medium
CN106296587B (en) Splicing method of tire mold images
CN103824275B (en) Saddle dots structure and the system and method for determining its information are searched in the picture
CN109509200A (en) Checkerboard angle point detection process, device and computer readable storage medium based on contours extract
CN111310753B (en) Meter alignment method and device
CN111161339B (en) Distance measuring method, device, equipment and computer readable medium
CN113469971B (en) Image matching method, detection device and storage medium
CN115482267A (en) Circle center positioning method, device, equipment and medium based on circular object
CN115482186A (en) Defect detection method, electronic device, and storage medium
CN110458954B (en) Contour line generation method, device and equipment
CN115690104B (en) Wafer crack detection method and device and storage medium
CN111445480A (en) Image rotation angle and zoom coefficient measuring method based on novel template
CN108564571B (en) Image area selection method and terminal equipment
CN111931786B (en) Image processing method and device and computer readable storage medium
CN114862870A (en) Speckle pattern partitioning method, device, equipment and medium
CN113033233B (en) Positioning method, device and storage medium for geometric deformation QR code
CN112884694B (en) Defect detection method, device, equipment and medium for flat display panel
CN116468804B (en) Laser radar and camera external parameter calibration precision evaluation method and device
CN115830043B (en) Boundary detection method, device, equipment and storage medium for wireless charging magnet
JP4027689B2 (en) Image rotation angle detection method, apparatus and recording medium
CN117807875B (en) Three-dimensional data reverse reconstruction and dimension measurement system and method for quartz device
CN113393513B (en) Film screen perforation measuring method, measuring device and computing equipment

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