A circle lookup method and device, electronic equipment and storage medium

By obtaining target reference points and performing edge extraction and fitting in circular pattern recognition, the problem of complex operation in existing technologies is solved, and circular pattern recognition with simplified user operation is realized.

CN114359548BActive Publication Date: 2025-11-04HANGZHOU HIKROBOT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111683480.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2025-11-04
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

In existing technologies, the process of recognizing circular patterns requires multiple inputs from the user, making the operation complex.

Method used

By obtaining the target reference point in the image to be identified, edge extraction is performed using this point as a reference to obtain at least three target edge points, and a circle is fitted based on these points, simplifying the user operation process.

Benefits of technology

It enables automatic circle recognition by simply requiring the user to input a point near the edge of a circular pattern, simplifying the operation process and improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114359548B_ABST
    Figure CN114359548B_ABST
Patent Text Reader

Abstract

The circle searching method and device, the electronic device and the storage medium provided by the embodiments of the present application can be applied to the field of information technology, can obtain a target reference point in a to-be-recognized image, the to-be-recognized image contains a circular pattern, and the target reference point is arranged near an edge of the circular pattern; edge extraction is performed with the target reference point as a reference, and at least three target edge points are obtained; and fitting of a circle is performed according to the at least three target edge points, and a fitted circle is obtained. Therefore, the user only needs to input a point near an edge of a circular pattern to realize circle searching, and thus the operation process of the user is simplified.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of information technology, and in particular to a circle searching method and device, electronic equipment and storage medium. BACKGROUND

[0002] In the field of machine vision, through the recognition of a circular pattern, positioning, measurement, etc. can be performed according to the recognition result. For example, the center of the circular pattern on the recognized object is taken as a reference point to determine the coordinate position of the recognized object.

[0003] However, in the current recognition of a circular pattern, the user often needs to input multiple times, for example, the position of the center of the circle is input by the user, and the radius of the circular pattern is input by dragging the mouse, etc. The circular recognized area is calculated, and then the recognition of the circular pattern is performed in the recognized area, which is complex. SUMMARY

[0004] The purpose of the embodiments of the present application is to provide a circle searching method, device, electronic equipment and storage medium to solve the problem of complex operation in the process of circular pattern recognition. The specific technical solutions are as follows:

[0005] The first aspect of the present application provides a circle searching method, comprising:

[0006] Obtaining a target reference point in a to-be-recognized image, wherein the to-be-recognized image contains a circular pattern, and the target reference point is configured near an edge of the circular pattern;

[0007] Performing edge extraction with the target reference point as a reference to obtain at least three target edge points;

[0008] Fitting a circle according to the at least three target edge points to obtain a fitted circle.

[0009] Optionally, the edge extraction with the target reference point as a reference to obtain at least three target edge points comprises:

[0010] Performing pixel gradient identification on each pixel point in a first preset range around the target reference point in the to-be-recognized image to obtain a first edge point, wherein the pixel gradient of the first edge point is greater than a preset gradient threshold;

[0011] Performing pixel gradient identification on each pixel point in a second preset range around the first edge point to obtain a plurality of second edge points;

[0012] Selecting at least three target edge points from the first edge point and the plurality of second edge points.

[0013] Optionally, the parameters of the fitted circle include position coordinates of the fitted circle, and after the fitting of the circle according to the at least three target edge points is performed to obtain the fitted circle, the method further includes:

[0014] generating a to-be-recognized region according to the position coordinates of the fitted circle;

[0015] performing recognition of the circle in the to-be-recognized region to obtain a recognition result, wherein the recognition result includes parameters of the recognized circle.

[0016] Optionally, the position coordinates of the fitted circle include a center coordinate of the fitted circle and a radius of the fitted circle, and the generating of the to-be-recognized region according to the position coordinates of the fitted circle includes:

[0017] calculating a feature parameter of the to-be-generated to-be-recognized region of a preset shape according to the radius of the fitted circle, wherein the preset shape is a circle or a rectangle, and the feature parameter is a radius of the circle or a length and a width of the rectangle;

[0018] generating the to-be-recognized region according to the center coordinate of the fitted circle as a center of the to-be-recognized region.

[0019] Optionally, the position coordinates of the fitted circle include a center coordinate of the fitted circle and a radius of the fitted circle, and the generating of the to-be-recognized region according to the position coordinates of the fitted circle includes:

[0020] calculating an inner diameter and an outer diameter of a ring-shaped to-be-recognized region according to the center coordinate of the fitted circle and the radius of the fitted circle;

[0021] generating the ring-shaped to-be-recognized region according to the center coordinate of the fitted circle as a center and according to the inner diameter and the outer diameter of the ring-shaped to-be-recognized region;

[0022] The performing of the recognition of the circle in the to-be-recognized region to obtain the recognition result includes:

[0023] performing the recognition of the circle in the ring-shaped to-be-recognized region to obtain the recognition result.

[0024] Optionally, the calculating of the inner diameter and the outer diameter of the ring-shaped to-be-recognized region according to the center coordinate of the fitted circle and the radius of the fitted circle includes:

[0025] calculating a sum of the radius of the fitted circle and a preset ring-shaped region width to obtain the outer diameter of the to-be-recognized region, and calculating a difference between the radius of the fitted circle and the preset ring-shaped region width to obtain the inner diameter of the to-be-recognized region.

[0026] Optionally, the pixel gradient identification is performed on each pixel point in the second preset range around the first edge point to obtain a plurality of second edge points, including:

[0027] The pixel gradient identification is performed on each pixel point in the clockwise and counterclockwise directions of the first edge point in the second preset range around the first edge point to obtain the plurality of second edge points.

[0028] Optionally, the pixel gradient identification is performed on each pixel point in the first preset range around the target reference point in the to-be-identified image to obtain a first edge point, including:

[0029] The pixel gradient identification is performed on each pixel point in a plurality of preset directions in the first preset range around the target reference point in the to-be-identified image to obtain a first edge point.

[0030] Optionally, the pixel gradient identification is performed on each pixel point in a plurality of preset directions in the first preset range around the target reference point in the to-be-identified image to obtain a first edge point, including:

[0031] In the first preset range around the target reference point in the to-be-identified image, a direction is selected every interval of a preset angle span according to a preset reference direction to obtain a plurality of target directions;

[0032] The pixel gradient identification is performed on each pixel point in the preset reference direction and the plurality of target directions to obtain a first edge point.

[0033] Optionally, the at least three target edge points are selected from the first edge point and the plurality of second edge points, including:

[0034] Down-sampling is performed on the plurality of second edge points to obtain at least three third sampling edge points;

[0035] The fitting of a circle is performed according to the at least three target edge points to obtain a fitted circle, including:

[0036] The fitting of a circle is performed according to the at least three third sampling edge points to obtain the fitted circle.

[0037] Optionally, the identification of a circle is performed in the to-be-identified region to obtain an identification result, including:

[0038] The areas of the to-be-identified region and the fitted circle are compared;

[0039] When the proportion of the area of the to-be-identified region to the area of the fitted circle is greater than a preset threshold, an updated to-be-identified region is generated according to the target reference point and the size of a preset region;

[0040] Performing circle identification in the updated to-be-identified region to obtain an identification result.

[0041] Optionally, the edge extraction based on the target reference point comprises:

[0042] Receiving to-be-identified region information input by a user, wherein the to-be-identified region information comprises the size and position of the to-be-identified region input by the user;

[0043] Performing edge extraction in the to-be-identified region based on the target reference point to obtain at least three target edge points.

[0044] In a second aspect, the application provides a circle finding device, comprising:

[0045] A reference point acquisition module configured to acquire a target reference point in a to-be-identified image, wherein the to-be-identified image comprises a circular pattern, and the target reference point is arranged near an edge of the circular pattern;

[0046] An edge point selection module configured to perform edge extraction based on the target reference point to obtain at least three target edge points;

[0047] A circle fitting module configured to perform fitting of a circle based on the at least three target edge points to obtain a fitted circle.

[0048] Optionally, the edge point selection module comprises:

[0049] A first edge point detection module configured to perform pixel gradient identification on each pixel point within a first preset range around the target reference point in the to-be-identified image to obtain a first edge point, wherein the pixel gradient of the first edge point is greater than a preset gradient threshold;

[0050] A second edge point detection module configured to perform pixel gradient identification on each pixel point within a second preset range around the first edge point to obtain a plurality of second edge points;

[0051] A target edge point acquisition module configured to select at least three target edge points from the first edge point and the plurality of second edge points.

[0052] Optionally, the parameters of the fitted circle comprise the position coordinates of the fitted circle, and the device further comprises:

[0053] A to-be-identified region generation module configured to generate a to-be-identified region based on the position coordinates of the fitted circle;

[0054] A to-be-identified region identification module configured to perform circle identification in the to-be-identified region to obtain an identification result, wherein the identification result comprises the parameters of the identified circle.

[0055] Optionally, the position coordinates of the fitted circle include a center coordinate of the fitted circle and a radius of the fitted circle, and the to-be-recognized region generation module comprises:

[0056] a feature parameter calculation module, configured to calculate a feature parameter of the to-be-generated preset shape to-be-recognized region according to the radius of the fitted circle, wherein the preset shape is a circle or a rectangle, and the feature parameter is a radius of the circle or a length and a width of the rectangle;

[0057] a feature parameter generation module, configured to generate the to-be-recognized region according to the feature parameter, with the center coordinate of the fitted circle as a center of the to-be-recognized region.

[0058] Optionally, the position coordinates of the fitted circle include a center coordinate of the fitted circle and a radius of the fitted circle, and the to-be-recognized region generation module comprises:

[0059] an inner-outer diameter calculation submodule, configured to calculate an inner diameter and an outer diameter of the annular to-be-recognized region according to the center coordinate of the fitted circle and the radius of the fitted circle;

[0060] an annular region generation submodule, configured to generate the annular to-be-recognized region according to the inner diameter and the outer diameter of the annular to-be-recognized region, with the center coordinate of the fitted circle as a center;

[0061] the to-be-recognized region identification module is specifically configured to perform circle identification in the annular to-be-recognized region to obtain an identification result.

[0062] Optionally, the inner-outer diameter calculation submodule is specifically configured to calculate a sum of the radius of the fitted circle and a preset annular region width to obtain the outer diameter of the to-be-recognized region, and calculate a difference between the radius of the fitted circle and the preset annular region width to obtain the inner diameter of the to-be-recognized region.

[0063] Optionally, the second edge point detection module is specifically configured to perform pixel gradient identification on each pixel point in a clockwise direction and an anticlockwise direction of the first edge point to obtain the plurality of second edge points, within a second preset range around the first edge point.

[0064] Optionally, the first edge point detection module is specifically configured to perform pixel gradient identification on each pixel point in a plurality of preset directions within a first preset range around a target reference point in the to-be-recognized image to obtain the first edge point.

[0065] Optionally, the first edge point detection module comprises:

[0066] The direction selection submodule is configured to select a direction every interval of a preset angle span according to a preset reference direction in a first preset range around a target reference point in the image to be recognized, and obtain a plurality of target directions.

[0067] The pixel recognition submodule is configured to perform pixel gradient recognition on each pixel point in the preset reference direction and the plurality of target directions, and obtain a first edge point.

[0068] Optionally, the target edge point acquisition module is specifically configured to perform down-sampling on the plurality of second edge points, and obtain at least three third sampling edge points.

[0069] The circle fitting module is specifically configured to perform circle fitting according to the at least three third sampling edge points, and obtain the fitted circle.

[0070] Optionally, the region to be recognized identification module comprises:

[0071] The area comparison submodule is configured to compare the areas of the region to be recognized and the fitted circle.

[0072] The region updating submodule is configured to generate an updated region to be recognized according to the target reference point and a preset region size when the proportion of the area of the region to be recognized to the area of the fitted circle is greater than a preset threshold.

[0073] The updated region identification submodule is configured to perform circle identification in the updated region to be recognized, and obtain an identification result.

[0074] Optionally, the edge point selection module comprises:

[0075] The region information receiving submodule is configured to receive user region to be recognized information, wherein the region to be recognized information comprises a size and a position of a region to be recognized input by a user.

[0076] The region edge extraction submodule is configured to perform edge extraction in the region to be recognized with the target reference point as a reference, and obtain at least three target edge points.

[0077] Another aspect of the embodiment of the present application also provides an electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus.

[0078] The memory is configured to store a computer program.

[0079] The processor is configured to execute the program stored on the memory, and implement the steps of any of the circle searching methods.

[0080] Another aspect of the embodiments of the present application also provides a computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, and the computer program is executed by a processor to implement any of the steps of the circle finding method.

[0081] Another aspect of the embodiments of the present application also provides a computer program product comprising instructions which, when executed on a computer, cause the computer to carry out any of the steps of the circle finding method.

[0082] The embodiments of the present application have the following beneficial effects:

[0083] The circle finding method, device, electronic device and storage medium provided by the embodiments of the present application can obtain a target reference point in a to-be-recognized image, wherein the to-be-recognized image contains a circular pattern, and the target reference point is configured near an edge of the circular pattern; edge extraction is performed with the target reference point as a reference to obtain at least three target edge points; and fitting of a circle is performed according to the at least three target edge points to obtain a fitted circle. Thus, the circle finding can be implemented only by inputting a point near an edge of a circular pattern by a user, thereby simplifying the operation process of the user.

[0084] Of course, implementing any product or method of the present application does not necessarily need to achieve all the advantages described above at the same time. BRIEF DESCRIPTION OF DRAWINGS

[0085] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description only constitute some embodiments of the present application, and other embodiments can also be obtained by those skilled in the art according to these drawings.

[0086] Figure 1 A flowchart of a circle finding method provided by the embodiments of the present application;

[0087] Figure 2 A flowchart of a circle finding method provided by the embodiments of the present application;

[0088] Figure 3 An example diagram of a circle finding method provided by the embodiments of the present application;

[0089] Figure 4 A flowchart of generating a to-be-recognized region provided by the embodiments of the present application;

[0090] Figure 5 Another example diagram of a circle finding method provided by the embodiments of the present application;

[0091] Figure 6A structural schematic diagram of a circle searching device provided by an embodiment of the present application is shown in the figure.

[0092] Figure 7 A structural schematic diagram of an electronic device provided by an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION

[0093] The technical solutions in the embodiments of the present application will be clearly and completely described with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art based on the present application belong to the scope of protection of the present application.

[0094] First, the terms possibly used in the embodiments of the present application are explained:

[0095] Single point: a point in pixel coordinates.

[0096] Search circle: locate the specific position of a circle, and give the center position and radius length of the circle.

[0097] ROI (region of interest): a defined area in which the algorithm performs operations.

[0098] Search point: a point near the circumference given by the user, used to search for a circle.

[0099] Chessboard distance: the maximum value of the absolute value of the horizontal coordinate difference and the absolute value of the vertical coordinate difference of two pixel points.

[0100] RANSAC (Random Sample Consensus): estimates the parameters of a mathematical model from a set of observed data containing outliers in an iterative manner.

[0101] In order to solve the problem that the user needs to input multiple times and the operation is complex when identifying a circular pattern in the prior art.

[0102] The first aspect of the embodiments of the present application provides a circle searching method, comprising:

[0103] Obtaining a target reference point in a to-be-identified image, wherein the to-be-identified image contains a circular pattern, and the target reference point is configured near an edge (i.e. a circumference) of the circular pattern;

[0104] Performing edge extraction with the target reference point as a reference to obtain at least three target edge points;

[0105] Fitting a circle according to the at least three target edge points to obtain a fitted circle.

[0106] It can be seen that, by the method of the embodiment of the present application, the user only needs to input a point of the edge of a circular pattern to realize the search of the circle, thereby simplifying the operation process of the user.

[0107] Specifically, referring to Figure 1 , Figure 1 A flowchart of the method for searching a circle provided by the embodiment of the present application, comprising:

[0108] In step S11, a target reference point in a to-be-recognized image is acquired.

[0109] The to-be-recognized image in the embodiment of the present application is an image including a circular pattern, wherein the to-be-recognized image contains a circular pattern, and the target reference point is a single point, which can be a manually input point. Specifically, a point can be marked as a reference point in the to-be-recognized image by means of manual touch or mouse clicking, or the coordinate position of the reference point can be input by means of a keyboard. When the method of the embodiment of the present application is applied to a device such as a smart phone, the target reference point can also be selected by a user through a touch screen. In actual use, the target reference point can be set on the edge of the circular pattern to be recognized, or near the edge of the circular pattern to be recognized.

[0110] In the conventional method, the reference point is generally placed on the center or circumference of the circle to determine the center coordinates and the radius, and then the circle is searched according to the determined center and radius. However, due to the operation error of the user, the reference point cannot be completely placed on the center of the circle, which often requires multiple operations and complicated operations. However, the method of the embodiment of the present application only needs to place the reference point near the circumference to realize the selection of the target reference point, thereby simplifying the operation process and improving the user experience.

[0111] The method of the embodiment of the present application is applied to a smart terminal, which can be implemented by the smart terminal. Specifically, the smart terminal can be a computer, a mobile phone, a server or a smart camera.

[0112] In step S12, edge extraction is performed with the target reference point as a reference to obtain at least three target edge points.

[0113] The target reference point is arranged near the side (i.e., the circumference of the circular pattern) of the circular pattern in the to-be-identified image. Optionally, edge extraction is performed based on the target reference point to obtain at least three target edge points, including: performing pixel gradient identification on each pixel point in a first preset range around the target reference point in the to-be-identified image to obtain a first edge point, wherein the pixel gradient of the first edge point is greater than a preset gradient threshold; performing pixel gradient identification on each pixel point in a second preset range around the first edge point to obtain a plurality of second edge points; and selecting at least three target edge points from the first edge point and the plurality of second edge points. Optionally, edge extraction is performed based on the target reference point to obtain at least three target edge points, including: receiving to-be-identified region information input by a user, wherein the to-be-identified region information includes the size and position of the to-be-identified region input by the user; and performing edge extraction in the to-be-identified region based on the target reference point to obtain at least three target edge points.

[0114] The pixel gradient of the first edge point is greater than a preset gradient threshold. In the embodiment of the present application, the pixel gradient identification on each pixel point in the first preset range around the target reference point in the to-be-identified image can be performed by a preset detection algorithm to identify the pixel value of each pixel point in the first preset range around the target reference point in the to-be-identified image, and then the pixel gradient corresponding to the pixel point is calculated according to the identified pixel value. In actual use, the pixel gradient of each pixel point can be calculated by calculating a Sobel operator. Specifically, the preset detection algorithm can be any edge point detection algorithm, such as a canny algorithm (a kind of edge detection algorithm). In one example, the pixel gradient identification on each pixel point in the first preset range around the target reference point in the to-be-identified image can be performed by sequentially searching the pixel points at a chessboard distance of 0, 1, 2, … from the target reference point and determining whether they are edge points to obtain the first edge point. The first edge point can include a plurality of pixel points.

[0115] The size of the first preset range can be set according to actual conditions. In one example, the smaller the range of the circle to be identified, the smaller the first preset range should be, and the larger the range of the circle to be identified, the larger the first preset range can be. For example, if the range of the to-be-identified image is large and the range of the circular pattern to be identified is small, the first preset range can be set to identify only the points in a small range around the target reference point. Thus, not only can the search for edge points be accelerated, but also the working memory and calculation amount can be reduced. When the range of the circular pattern to be identified is large, a larger range around the target reference point should be identified.

[0116] Optionally, the pixel gradient of each pixel point in the first preset range around the target reference point in the image to be identified is identified to obtain the first edge point, including: the pixel gradient of each pixel point in the first preset range around the target reference point in the image to be identified in multiple preset directions is identified to obtain the first edge point. Optionally, the pixel gradient of each pixel point in the first preset range around the target reference point in the image to be identified in multiple preset directions is identified to obtain the first edge point, including: in the first preset range around the target reference point in the image to be identified, a direction is selected every interval preset angle according to the preset reference direction to obtain multiple target directions; the pixel gradient of each pixel point in the preset reference direction and the multiple target directions is identified to obtain the first edge point. In one example, the preset direction can be one or more of the eight directions, which are the up, down, left and right four directions of the target reference point, and the four directions with an interval of 45° between adjacent two directions.

[0117] The pixel gradient of each pixel point in the second preset range around the first edge point is identified to obtain multiple second edge points. The size of the second preset range can be the same as or different from the size of the first preset range. When searching for the multiple second edge points in the second preset range around the first edge point, the first edge point can be taken as the starting point to search for other edge points on the circumferential contour. In the search, all the edge points are searched as much as possible to make the edge points cover all positions on the circumference. The pixel gradient of each pixel point in the second preset range around the first edge point can be identified by any of the above edge point detection algorithms, such as the canny algorithm.

[0118] Optionally, the pixel gradient of each pixel point in the second preset range around the first edge point is identified to obtain multiple second edge points, including: the pixel gradient of each pixel point in the clockwise and counterclockwise directions of the first edge point in the second preset range around the first edge point is identified to obtain multiple second edge points. When the radius of the circular pattern is relatively large, these edge points can be sampled, and only the sampled edge points can be retained to reduce the consumption of memory and the amount of subsequent calculation.

[0119] At least three target edge points are selected from the first edge point and the multiple second edge points. Since at least three edge points are required for the fitting of a circle, after obtaining the first edge point and the multiple edge points, three edge points are selected for the fitting of a circle. The at least three target edge points can be the first edge point and the multiple second edge points, or at least three edge points in the second edge points. In the selection of the at least three target edge points from the first edge point and the multiple second edge points, three edge points can be selected as target edge points from the first edge point and the multiple second edge points by a random selection method.

[0120] Step S13, fitting a circle according to the at least three target edge points to obtain a fitted circle.

[0121] The fitting of the circle according to the at least three target edge points can be performed by various preset circle fitting methods, such as a least square method or a least square method based on RANSAC, to obtain the fitted circle and parameters of the fitted circle, such as a radius and a center coordinate. Then, the parameters of the fitted circle are taken as the parameters of the circular pattern in the image to be recognized.

[0122] In selecting the at least three edge points as the target edge points from the first edge point and the plurality of second edge points, the at least three edge points can be selected as the target edge points from the first edge point and the plurality of second edge points by a downsampling method. Alternatively, the selecting of the at least three target edge points from the first edge point and the plurality of second edge points includes: downsampling the plurality of second edge points to obtain at least three third sampling edge points; and fitting a circle according to the at least three target edge points to obtain a fitted circle, which includes: fitting a circle according to the at least three third sampling edge points to obtain a fitted circle. Since the number of the third edge points after the downsampling is less than the number of the second edge points, the third edge points can be uniformly distributed on the fitted circle by the distance between the third edge points during the downsampling. Therefore, the number of the second edge points to be calculated and saved can be reduced by the downsampling, thereby reducing the consumption of memory and the subsequent calculation amount and improving the fitting efficiency.

[0123] It can be seen that, by the method of the embodiments of the present application, only one target reference point needs to be input by the user to automatically recognize the first edge point and the plurality of second edge points, so that the parameters of the circle in the image to be recognized are obtained by fitting a circle according to the first edge point and the second edge points, thereby simplifying the operation process of the user.

[0124] Alternatively, referring to Figure 2 , the parameters of the fitted circle include a position coordinate of the fitted circle, and after the fitting of the circle according to the at least three target edge points to obtain the fitted circle, the above method further includes:

[0125] Step S21, generating a to-be-recognized region according to the position coordinate of the fitted circle;

[0126] Step S22, performing a circle recognition in the to-be-recognized region to obtain a recognition result, wherein the recognition result includes parameters of the recognized circle.

[0127] Optionally, the position coordinates of the fitted circle include a center coordinate of the fitted circle and a radius of the fitted circle, and the to-be-identified region is generated according to the position coordinates of the fitted circle, including: calculating a feature parameter of the to-be-generated to-be-identified region of the preset shape according to the radius of the fitted circle, wherein the preset shape is a circle or a rectangle, and the feature parameter is the radius of the circle or the length and width of the rectangle; and taking the center coordinate of the fitted circle as the center of the to-be-generated to-be-identified region to generate the to-be-identified region. In the calculation of the feature parameter of the to-be-generated to-be-identified region of the preset shape, the to-be-generated to-be-identified region of the preset shape can contain the entire fitted circle, for example, when the preset shape is a circle, the radius of the to-be-identified region of the preset shape is greater than the radius of the fitted circle, for example, when the radius of the fitted circle is 4, the radius of the to-be-identified region of the preset shape can be 5. For another example, when the radius of the fitted circle is 4, the length and width of the to-be-identified region of the preset shape are both greater than twice the radius of the fitted circle, for example, when the radius of the fitted circle is 4, the length and width of the to-be-identified region of the preset shape can be 9 and 10 respectively.

[0128] The to-be-identified region can be a region of various shapes, for example, the to-be-identified region can be a circle, a ring, a square, a rectangle, etc. In the generation of the to-be-identified region, the range of the to-be-identified region should include the range of the circular pattern in the to-be-identified image.

[0129] Optionally, the identification of the circle in the to-be-identified region is performed to obtain an identification result, including: comparing the areas of the to-be-identified region and the fitted circle; when the proportion of the areas of the to-be-identified region and the fitted circle is greater than a preset threshold, generating an updated to-be-identified region according to the target reference point and the size of the preset region; and performing the identification of the circle in the updated to-be-identified region to obtain the identification result. In an example, the smaller the range of the circle to be identified, the smaller the first preset range should be, and the larger the range of the circle to be identified, the larger the first preset range can be. For example, if the range of the to-be-identified image is large and the range of the circular pattern to be identified is small, only the points in a small range around the target reference point can be identified through the setting of the first preset range. Thus, not only the searching of the edge points can be accelerated, but also the working memory and the calculation amount can be reduced. When the range of the circular pattern to be identified is large, a larger range around the target reference point should be identified.

[0130] In the embodiments of the present application, when the identification of the circular pattern in the to-be-identified region is performed through the preset identification method, the preset identification method can be various image identification methods, for example, RANSAC, etc. Figure 3 After the ROI is generated according to the parameters of the circular pattern, the searching of the circle with higher precision is performed in the ROI.

[0131] It can be seen that, by the method of the embodiment of the present application, the to-be-recognized region can be generated according to the position coordinates of the fitted circle, and then the identification of the circle is performed in the to-be-recognized region to obtain the identification result, so that, by performing the identification of the circular pattern in the to-be-recognized region, not only the identification result can be obtained and the accuracy of the identified parameters of the circle can be improved, but also the to-be-recognized region can be selected to search for the circle in the to-be-recognized region without searching in the entire image, so that the calculation amount is reduced and the calculation efficiency is improved.

[0132] Optionally, referring to Figure 4 , the position coordinates of the fitted circle include the center coordinates of the fitted circle and the radius of the fitted circle, and the to-be-recognized region is generated according to the position coordinates of the fitted circle, including:

[0133] In step S211, the inner diameter and the outer diameter of the annular to-be-recognized region are calculated according to the center coordinates of the fitted circle and the radius of the fitted circle.

[0134] In step S212, the annular to-be-recognized region is generated according to the inner diameter and the outer diameter of the annular to-be-recognized region with the center coordinates of the fitted circle as the center according to the feature parameters.

[0135] In step S22, the identification of the circle is performed in the to-be-recognized region to obtain the identification result, including:

[0136] In step S221, the identification of the circle is performed in the annular to-be-recognized region to obtain the identification result.

[0137] Optionally, the inner diameter and the outer diameter of the annular to-be-recognized region are calculated according to the center coordinates of the fitted circle and the radius of the fitted circle, including: the outer diameter of the to-be-recognized region is calculated by calculating the sum of the radius of the fitted circle and a preset annular region width; and the inner diameter of the to-be-recognized region is calculated by calculating the difference between the radius of the fitted circle and the preset annular region width.

[0138] According to the radius of the circular pattern and the preset length, the inner diameter and the outer diameter of the to-be-generated annular region are calculated, which can be obtained by subtracting a preset value from the radius of the circular pattern to obtain the inner diameter of the to-be-generated annular region, and the outer diameter of the to-be-generated annular region is obtained by adding the preset value to the radius of the circular pattern. Specifically, the preset value can be set according to the actual situation, and in one example, the size of the preset value corresponds to the radius of the circle, that is, the larger the radius of the circle, the larger the preset value, and the smaller the radius of the circle, the smaller the preset value. Then, the annular to-be-recognized region is generated according to the inner diameter and the outer diameter of the annular to-be-recognized region with the center coordinates of the fitted circle as the center. In the embodiment of the present application, the generated annular region includes all edge points of the circular pattern.

[0139] The identification of the circle in the annular to-be-identified region is performed to obtain an identification result. The identification of the circular pattern in the annular to-be-identified region can be performed by using the preset identification method to obtain the identification result. Specifically, the identification of the circular pattern in the annular to-be-identified region can be performed by using the RANSAC or other image identification method. In the embodiment of the application, the identification result can include the radius and the center coordinates of the circle. Since the annular region includes all the edge points of the circular pattern, and the area of the annular region is small, the region to be identified is small, and therefore the identification efficiency is higher.

[0140] It can be seen that, by using the method of the embodiment of the application, the inner diameter and the outer diameter of the annular to-be-identified region can be calculated according to the center coordinates of the fitted circle and the radius of the fitted circle, the annular to-be-identified region is generated according to the center coordinates of the fitted circle, the inner diameter and the outer diameter of the annular to-be-identified region, the identification of the circle is performed in the annular to-be-identified region, and the identification result is obtained, so that the region to be identified can be reduced, and the identification efficiency is improved.

[0141] Referring to Figure 5 , Figure 5 Another example of the circle finding method provided in the embodiment of the application is shown in the figure, which includes:

[0142] 1. Setting a point near the circumference for finding; the finding point in the disclosure is located near the circumference of the circular pattern.

[0143] 2. Image edge extraction; when the image to be detected is large and the diameter of the circle to be found is relatively small, only a small part of the entire image region, only the region near the finding point set by the user can be extracted to reduce the working memory and the calculation amount.

[0144] 3. Searching for the nearest edge point; specifically, the points with the chessboard distance of 0, 1, 2, … from the finding point can be searched in sequence, or the points on the circumference are searched along the fixed eight directions (the interval between two adjacent directions is 45°).

[0145] 4. Searching for other edge points along the edge; the edge points searched are saved from the clockwise and counterclockwise directions. Optionally, if the radius of the circle to be searched is relatively large, the edge points can be sampled to retain only the sampled edge points, so as to reduce the consumption of memory and the calculation amount in the subsequent process.

[0146] 5. Edge point fitting; the retained edge points are fitted to a circle. There are various ways for the circle fitting, such as the least square method or the least square method based on RANSAC, and finally the result of the single-point finding circle is obtained.

[0147] In a second aspect, the embodiment of the application provides a circle finding device, which is shown in Figure 6, comprising:

[0148] The reference point acquisition module 601 is configured to acquire a target reference point in a to-be-identified image, wherein the to-be-identified image contains a circular pattern, and the target reference point is arranged near an edge of the circular pattern.

[0149] The edge point selection module 602 is configured to perform edge extraction with the target reference point as a reference to obtain at least three target edge points.

[0150] The circle fitting module 603 is configured to perform fitting of a circle according to the at least three target edge points to obtain a fitted circle.

[0151] Optionally, the edge point selection module 602 comprises:

[0152] The first edge point detection module is configured to perform pixel gradient identification on each pixel point in a first preset range around the target reference point in the to-be-identified image to obtain a first edge point, wherein the pixel gradient of the first edge point is greater than a preset gradient threshold.

[0153] The second edge point detection module is configured to perform pixel gradient identification on each pixel point in a second preset range around the first edge point to obtain a plurality of second edge points.

[0154] The target edge point acquisition module is configured to select at least three target edge points from the first edge point and the plurality of second edge points.

[0155] Optionally, the parameters of the fitted circle include position coordinates of the fitted circle, and the apparatus further comprises:

[0156] The to-be-identified region generation module is configured to generate a to-be-identified region according to the position coordinates of the fitted circle.

[0157] The to-be-identified region identification module is configured to perform identification of a circle in the to-be-identified region to obtain an identification result, wherein the identification result includes parameters of the identified circle.

[0158] Optionally, the position coordinates of the fitted circle include a center coordinate of the fitted circle and a radius of the fitted circle, and the to-be-identified region generation module comprises:

[0159] The feature parameter calculation module is configured to calculate a feature parameter of a to-be-generated to-be-identified region of a preset shape according to the radius of the fitted circle, wherein the preset shape is a circle or a rectangle, and the feature parameter is a radius of the circle or a length and a width of the rectangle.

[0160] The feature parameter generation module is configured to generate the to-be-identified region with the center coordinate of the fitted circle as a center of the to-be-generated to-be-identified region according to the feature parameter.

[0161] Optionally, the position coordinates of the fitted circle include a center coordinate of the fitted circle and a radius of the fitted circle, the region-to-be-identified generation module comprises:

[0162] The inner-outer diameter calculation submodule is configured to calculate an inner diameter and an outer diameter of the annular region-to-be-identified according to the center coordinate of the fitted circle and the radius of the fitted circle.

[0163] The annular region generation submodule is configured to generate the annular region-to-be-identified according to the inner diameter and the outer diameter of the annular region-to-be-identified with the center coordinate of the fitted circle as the center.

[0164] The region-to-be-identified identification module is specifically configured to identify the circle in the annular region-to-be-identified to obtain an identification result.

[0165] Optionally, the inner-outer diameter calculation submodule is specifically configured to calculate a sum of the radius of the fitted circle and a preset annular region width to obtain the outer diameter of the region-to-be-identified, and calculate a difference between the radius of the fitted circle and the preset annular region width to obtain the inner diameter of the region-to-be-identified.

[0166] Optionally, the second edge point detection module is specifically configured to perform pixel gradient identification on each pixel point in the clockwise and counterclockwise directions of the first edge point within a second preset range around the first edge point to obtain a plurality of second edge points.

[0167] Optionally, the first edge point detection module is specifically configured to perform pixel gradient identification on each pixel point in a plurality of preset directions within a first preset range around the target reference point in the to-be-identified image to obtain the first edge point.

[0168] Optionally, the first edge point detection module comprises:

[0169] The direction selection submodule is configured to select a direction every preset angular span according to a preset reference direction within a first preset range around the target reference point in the to-be-identified image to obtain a plurality of target directions.

[0170] The pixel identification submodule is configured to perform pixel gradient identification on each pixel point in the preset reference direction and the plurality of target directions to obtain the first edge point.

[0171] Optionally, the target edge point acquisition module is specifically configured to down-sample the plurality of second edge points to obtain at least three third sampling edge points.

[0172] The circle fitting module is specifically configured to perform circle fitting according to the at least three third sampling edge points to obtain a fitted circle.

[0173] Optionally, the region-to-be-identified identification module comprises:

[0174] The area comparison submodule is configured to compare the area of the to-be-identified region and the area of the fitted circle.

[0175] The region updating submodule is configured to generate an updated to-be-identified region according to the target reference point and the size of the preset region when the ratio of the area of the to-be-identified region to the area of the fitted circle is greater than a preset threshold.

[0176] The updated region identification submodule is configured to identify the circle in the updated to-be-identified region to obtain an identification result.

[0177] Optionally, the edge point selection module 602 comprises:

[0178] The region information receiving submodule is configured to receive to-be-identified region information input by a user, wherein the to-be-identified region information comprises the size and position of the to-be-identified region input by the user.

[0179] The region edge extraction submodule is configured to extract edges in the to-be-identified region based on the target reference point to obtain at least three target edge points.

[0180] As can be seen, the device of the embodiments of the present application can realize the searching of a circle only by inputting a point of the edge of a circular pattern by a user, thereby simplifying the operation process of the user.

[0181] The embodiments of the present application further provide an electronic device, such as a mobile phone, a tablet computer, a computer, a server, a network device, a wearable device, or the like. Figure 7 As shown in the figure, the electronic device comprises a processor 701, a communication interface 702, a memory 703, and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 complete mutual communication through the communication bus 704,

[0182] The memory 703 is configured to store a computer program.

[0183] The processor 701 is configured to execute the program stored in the memory 703 to implement the following steps:

[0184] The processor 701 is configured to acquire a target reference point in a to-be-identified image, wherein the to-be-identified image comprises a circular pattern, and the target reference point is a point having a distance to an edge of the circular pattern less than a preset distance threshold.

[0185] The processor 701 is configured to perform edge extraction based on the target reference point to obtain at least three target edge points.

[0186] The processor 701 is configured to perform fitting of a circle according to the at least three target edge points to obtain a fitted circle.

[0187] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0188] The communication interface is used for communication between the above electronic device and other devices.

[0189] The memory can include a Random Access Memory (RAM) and can also include a Non-Volatile Memory (NVM), for example, at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.

[0190] The processor mentioned above can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0191] In another embodiment provided in the present application, a computer readable storage medium is also provided, and the computer readable storage medium stores a computer program. When the computer program is executed by a processor, the steps of any one of the above circle finding methods are implemented.

[0192] In another embodiment provided in the present application, a computer program product containing instructions is also provided, and when the computer program product is run on a computer, the computer is caused to execute any one of the circle finding methods in the above embodiments.

[0193] In the embodiments described above, all or some of the steps can be implemented by hardware, software, firmware or any combination thereof. When implemented by software, all or some of the steps can be implemented in the form of one or more computer programs or program elements. The computer programs reside (at least temporarily) in a memory of a computer during execution. The memory can be a RAM memory, a flash memory, a ROM memory, an EPROM memory, or any other suitable memory. The memory can be integral to or separate from the computer. The computer programs can be written in any suitable programming language, such as C, C++, Java, Visual Basic, etc. The computer programs can be written in assembly or machine language, if desired. The computer programs can be distributed over network coupled file servers, or can be distributed by any other suitable means.

[0194] It should be noted that, in the present document, relational terms such as first and second and the like can be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Furthermore, the term "comprising" is used to include not only the current embodiment but also any future embodiment.

[0195] Each of the embodiments described in the present specification is described in an associated manner, and the same or similar parts between the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. In particular, the device, electronic device, storage medium, and computer program product embodiments are described simply because they are substantially similar to the method embodiments, and the relevant parts can be referred to the part of the method embodiments.

[0196] The above merely provides the preferred embodiment of the present application, and not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A circle finding method, characterized by, The method comprises the following steps: acquiring a target reference point in a to-be-identified image, wherein the to-be-identified image contains a circular pattern, and the target reference point is arranged near an edge of the circular pattern; the target reference point is a manually input point; performing edge extraction with the target reference point as a reference to obtain at least three target edge points; performing fitting of a circle according to the at least three target edge points to obtain a fitted circle; the step of performing edge extraction with the target reference point as a reference to obtain at least three target edge points comprises the following steps: performing pixel gradient identification on each pixel point in a first preset range around the target reference point in the to-be-identified image to obtain a first edge point, wherein the pixel gradient of the first edge point is greater than a preset gradient threshold; performing pixel gradient identification on each pixel point in a second preset range around the first edge point to obtain a plurality of second edge points; selecting at least three target edge points from the first edge point and the plurality of second edge points.

2. The method of claim 1, wherein, The parameters of the fitted circle include the position coordinates of the fitted circle, and after the step of performing fitting of a circle according to the at least three target edge points to obtain a fitted circle, the method further comprises the following steps: generating a to-be-identified region according to the position coordinates of the fitted circle; performing identification of a circle in the to-be-identified region to obtain an identification result, wherein the identification result includes parameters of the identified circle.

3. The method of claim 2, wherein, The position coordinates of the fitted circle include the center coordinates of the fitted circle and the radius of the fitted circle, and the step of generating a to-be-identified region according to the position coordinates of the fitted circle comprises the following steps: calculating feature parameters of a to-be-generated to-be-identified region of a preset shape according to the radius of the fitted circle, wherein the preset shape is a circle or a rectangle, and the feature parameters are the radius of the circle or the length and width of the rectangle; generating a to-be-identified region according to the feature parameters, with the center coordinates of the fitted circle as the center of the to-be-generated to-be-identified region.

4. The method of claim 2, wherein, The position coordinates of the fitted circle include the center coordinates of the fitted circle and the radius of the fitted circle, and the step of generating a to-be-identified region according to the position coordinates of the fitted circle comprises the following steps: calculating the inner diameter and the outer diameter of a ring-shaped to-be-identified region according to the center coordinates of the fitted circle and the radius of the fitted circle; generating a ring-shaped to-be-identified region according to the center coordinates of the fitted circle, the inner diameter and the outer diameter of the ring-shaped to-be-identified region; the step of performing identification of a circle in the to-be-identified region to obtain an identification result comprises the following step: performing identification of a circle in the ring-shaped to-be-identified region to obtain an identification result.

5. The method of claim 4, wherein, The step of calculating the inner diameter and the outer diameter of a ring-shaped to-be-identified region according to the center coordinates of the fitted circle and the radius of the fitted circle comprises the following steps: calculating the sum of the radius of the fitted circle and a preset ring-shaped region width to obtain the outer diameter of the to-be-identified region; and calculating the difference between the radius of the fitted circle and the preset ring-shaped region width to obtain the inner diameter of the to-be-identified region.

6. The method of claim 1, wherein, the step of performing pixel gradient identification on each pixel point in a second preset range around the first edge point to obtain a plurality of second edge points comprises the following steps: Within a second preset range around the first edge point, pixel gradient identification is performed on each pixel point in the clockwise and counterclockwise directions of the first edge point, to obtain the plurality of second edge points.

7. The method of claim 1, wherein, The pixel gradient identification on each pixel point in the first preset range around the target reference point in the image to be identified includes: The pixel gradient identification on each pixel point in the plurality of preset directions in the first preset range around the target reference point in the image to be identified includes:

8. The method of claim 7, wherein, The pixel gradient identification on each pixel point in the plurality of preset directions in the first preset range around the target reference point in the image to be identified includes: Within the first preset range around the target reference point in the image to be identified, a direction is selected every interval of a preset angle span according to a preset reference direction, to obtain a plurality of target directions; The pixel gradient identification on each pixel point in the preset reference direction and the plurality of target directions is performed to obtain the first edge point.

9. The method of claim 1, wherein, The selection of at least three target edge points from the first edge point and the plurality of second edge points includes: Down-sampling is performed on the plurality of second edge points to obtain at least three third sampling edge points; The fitting of a circle according to the at least three target edge points includes: The fitting of a circle according to the at least three third sampling edge points is performed to obtain the fitted circle.

10. The method of claim 2, wherein, The identification of a circle in the region to be identified to obtain an identification result includes: The areas of the region to be identified and the fitted circle are compared; When the proportion of the area of the region to be identified to the area of the fitted circle is greater than a preset threshold, an updated region to be identified is generated according to the target reference point and the size of a preset region; Identification of a circle in the updated region to be identified is performed to obtain an identification result.

11. The method of claim 1, wherein, The edge extraction with the target reference point as a reference to obtain at least three target edge points includes: User region to be identified information is received, wherein the region to be identified information includes the size and position of the region to be identified input by a user; Edge extraction is performed in the region to be identified with the target reference point as a reference to obtain at least three target edge points.

12. A circle finding apparatus, characterized by It includes: A reference point acquisition module is configured to acquire a target reference point in an image to be identified, wherein the image to be identified contains a circular pattern, the target reference point is configured near an edge of the circular pattern, and the target reference point is a point input by a human being; An edge point selection module is configured to perform edge extraction with the target reference point as a reference to obtain at least three target edge points; A circle fitting module is configured to fit a circle according to the at least three target edge points to obtain a fitted circle; The edge point selection module includes: A first edge point detection module is configured to perform pixel gradient identification on each pixel point in a first preset range around a target reference point in an image to be identified to obtain a first edge point, wherein the pixel gradient of the first edge point is greater than a preset gradient threshold. a second edge point detection module, configured to perform pixel gradient identification on each pixel point in a second preset range around the first edge point to obtain a plurality of second edge points; a target edge point acquisition module, configured to select at least three target edge points from the first edge point and the plurality of second edge points.

13. An electronic device, comprising: The device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus. The memory is configured to store a computer program. The processor is configured to execute the program stored on the memory to implement the method steps in any one of claims 1-11.

14. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method steps in any one of claims 1-11.

Citation Information

Patent Citations

  • Image identification apparatus, image identification method, and non-transitory computer-readable storage medium for storing image identification program

    US20210182591A1