Circle detection method, device, electronic device and storage medium

The method simplifies circular pattern recognition by using a single point near the edge to detect circles, reducing operational complexity and errors in conventional multi-input methods.

JP2024547167AActive Publication Date: 2024-12-26HANGZHOU HIKROBOT TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
JP2024539659
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2021-12-31
Filing Date
2022-09-13
Publication Date
2024-12-26
Estimated Expiration
2042-09-13

AI Technical Summary

Technical Problem

Conventional circular pattern recognition requires multiple user inputs, such as positioning the center and radius, making the operation complex and prone to errors.

Method used

A method and device for circle detection that involves obtaining a target reference point near the edge of a circular pattern, performing edge extraction to get at least three edge points, and fitting a circle based on these points, simplifying the user input to a single point near the edge.

Benefits of technology

Simplifies the user operation process by allowing circle detection through a single point input, reducing operational complexity and errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024547167000001_ABST
    Figure 2024547167000001_ABST
Patent Text Reader

Abstract

The circle detection method, device, electronic device and storage medium provided in the embodiments of the present application are applied to the information technology field, and obtain a target reference point in an image to be recognized. The image to be recognized includes a circular pattern, and the target reference point is located within a preset range of an edge of the circular pattern. An edge extraction is performed based on the target reference point to obtain at least three target edge points. A circle fitting is performed based on the at least three target edge points to obtain a fitted circle. In this way, a user only needs to input points near the edge of a circular pattern to realize circle detection, which simplifies the user's operation process.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] (CROSS REFERENCE TO RELATED APPLICATIONS) This application claims priority to a Chinese patent application bearing application number 202111683480.2 and titled "Circle detection method, apparatus, electronic device and storage medium" filed with the State Intellectual Property Office of the People's Republic of China on December 31, 2021, the entire contents of which are incorporated herein by reference.

[0002] The present application relates to the field of information technology, and in particular to a circle detection method, device, electronic device and storage medium. [Background technology]

[0003] In the field of machine vision, by recognizing a circular pattern, it is possible to perform positioning, measurement, etc. based on the recognition result. For example, the coordinate position of the recognized object is determined by using the center of the circular pattern on the recognized object as a reference point.

[0004] However, conventionally, when recognizing a circular pattern, the user must often input data multiple times. For example, the user must input the position of the center of the circle and the radius of the circular pattern by dragging the mouse, calculate the circular recognition target area, and then recognize the circular pattern in the recognition target area, which results in complicated operations. Summary of the Invention

[0005] The present embodiment aims to provide a circle detection method, device, electronic device and storage medium to solve the problem of complicated operations in the process of recognizing circular patterns. The specific technical solutions are as follows:

[0006] As a first aspect of the present embodiment, Obtaining a target reference point in a recognition target image, the recognition target image including a circular pattern, and the target reference point being located within a preset range of an edge of the circular pattern; Performing edge extraction based on the target reference point to obtain at least three target edge points; and performing a circle fitting based on the at least three target edge points to obtain a fitted circle. A circle detection method is provided.

[0007] As a second aspect of the present embodiment, a reference point acquisition module for acquiring a target reference point in a recognition target image, the recognition target image including a circular pattern, and the target reference point being located within a preset range of an edge of the circular pattern; an edge point selection module for performing edge extraction based on the target reference point to obtain at least three target edge points; and a circle fitting module for fitting a circle based on the at least three target edge points to obtain a fitted circle. A circle detection device is provided.

[0008] As another aspect of the present embodiment, An electronic device including a processor, a communication interface, a memory, and a communication bus, the processor, the communication interface, and the memory communicating with each other via the communication bus; The memory is used to store computer programs. The present invention further provides an electronic device in which a processor, when executing a program stored in the memory, is used to implement the steps of any of the above circle detection methods.

[0009] As another aspect of the present embodiment, There is further provided a computer readable storage medium having a computer program stored thereon, the computer program implementing the steps of any of the above circle detection methods when executed by a processor.

[0010] As another aspect of the present embodiment, There is further provided a computer program product comprising commands which, when executed on a computer, cause the computer to perform the steps of any of the above circle detection methods.

[0011] The beneficial effects of the embodiments of the present application are as follows:

[0012] The circle detection method, device, electronic device and storage medium provided in the embodiments of the present application include: obtaining a target reference point in an image to be recognized, the image to be recognized includes a circular pattern, and the target reference point is located within a preset range of an edge of the circular pattern; performing edge extraction based on the target reference point to obtain at least three target edge points; and performing circle fitting based on the at least three target edge points to obtain a fitted circle. In this way, the user only needs to input a point near the edge of a circular pattern to realize circle detection, which simplifies the user's operation process.

[0013] Of course, it is not necessary for the practice of any product or method herein to achieve all of the above advantages simultaneously. [Brief description of the drawings]

[0014] In order to more clearly explain the technical solutions of the embodiments of the present application and the prior art, the drawings necessary for the following embodiments and the prior art will be briefly described. Of course, the drawings described below are only a part of the embodiments of the present application, and those skilled in the art can obtain other embodiments based on these drawings without creative efforts. [Figure 1] FIG. 1 is a process diagram of the circle detection method provided in the present embodiment. [Diagram 2] FIG. 2 is a process diagram of the circle detection method provided in the present embodiment. [Diagram 3] FIG. 3 is an example diagram of a circle detection method provided by an embodiment of the present application. [Figure 4]FIG. 4 is a process diagram for generating a recognition target region provided in the present embodiment. [Diagram 5] FIG. 5 is another illustrative diagram of a circle detection method provided by an embodiment of the present application. [Figure 6] FIG. 6 is a schematic diagram of the configuration of a circle detection device provided in this embodiment. [Figure 7] FIG. 7 is a schematic diagram showing the configuration of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0015] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be described in more detail below with reference to the drawings and examples. It is clear that the described examples are only some of the embodiments of the present invention, and are not all of the embodiments. Based on the embodiments of the present invention, all other embodiments that can be obtained by those skilled in the art without creative efforts are all included in the protection scope of the present invention.

[0016] First, the terms used in the embodiments of the present invention will be explained. Single point: A single point in pixel coordinates. Circle detection: The specific position of a circle is determined, and the center position and radius length of the circle are displayed. ROI (region of interest): A defined area within which an algorithm performs operations. Detection points: points near the circumference provided by the user, used to detect the circle. Chessboard distance: The maximum value of the absolute difference between the abscissa and ordinate of two pixel points. RANSAC (Random Sample Consensus): Iteratively estimates the parameters of a mathematical model from a set of observed data that may contain outliers.

[0017] In order to solve the problem of the conventional technology that the user needs to input multiple times when recognizing a circular pattern, and the operation is complicated, As a first aspect of the present embodiment, Obtaining a target reference point in a recognition target image, the recognition target image including a circular pattern, the target reference point being located within a preset range of an edge of the circular pattern (i.e., a circumference of the circular pattern); Performing edge extraction based on the target reference point to obtain at least three target edge points; fitting a circle based on the at least three target edge points to obtain a fitted circle. A circle detection method is provided.

[0018] As can be seen, the method of the present embodiment allows the user to realize circle detection by only inputting points near the edge of a single circular pattern, thus simplifying the user's operation process.

[0019] Specifically, refer to FIG. 1, which is a process diagram of a circle detection method provided in an embodiment of the present application, and the circle detection method includes the following steps:

[0020] Step S11: A target reference point in the recognition target image is obtained.

[0021] In the embodiment of the present application, the image to be recognized is an image including a circular pattern, and the target reference point may be a single point, which may be a point input by a person. Specifically, a point may be added as a reference point to the image to be recognized by a touch operation or a mouse, and the coordinate position of the reference point may be input by a keyboard. When the method of the embodiment of the present application is applied to a device such as a smartphone, the target reference point may be selected by a touch operation or the like by a person. In the practical process, a user may input a point near an edge of a circular pattern as the target reference point. Specifically, this point may be a point on the edge, or may not be a point on the edge. In the practical process, the target reference point may be set on the edge of the circular pattern to be recognized, or may be set within a preset range of the edge of the circular pattern to be recognized. This preset range may be set in advance, and specifically, this preset range may include the target reference point and a point on the edge of the circular pattern at the same time.

[0022] In the conventional method, in the process of detecting a circle, it is usually necessary to place a reference point on the circle center and the circumference, and by determining the circle center coordinate and the radius, the circle is detected based on the determined circle center and radius. However, due to operation errors, users often cannot accurately place the reference point on the circle center, so multiple operations are often required, and the operation is complicated and there are errors. The method of the embodiment of the present application can realize the selection of the target reference point by only placing the reference point within a preset range of the circumference, simplifying the operation process and improving the user experience.

[0023] The method of the present embodiment can be applied to and implemented by an intelligent terminal, which can be a computer, a mobile phone, a server, an intelligent camera, etc.

[0024] Step S12: Extracting edges based on the target reference points to obtain at least three target edge points.

[0025] The image to be recognized includes a circular pattern, and the target reference point is disposed within a preset range of an edge of the circular pattern (i.e., a circumference of the circular pattern). Specifically, the preset range may be a first preset range. Preferably, performing edge extraction based on the target reference point to obtain at least three target edge points includes: performing pixel gradient recognition for each pixel point within a first preset range around the target reference point in the image to be recognized to obtain a first edge point, where the pixel gradient of the first edge point is greater than a preset gradient threshold; performing pixel gradient recognition for each pixel point within a second preset range around the first edge point to obtain a plurality of second edge points; and obtaining at least three target edge points from the first edge point and the plurality of second edge points. Preferably, performing edge extraction based on the target reference point to obtain at least three target edge points includes receiving user's target area information, where the target area information includes a size and a position of the target area input by the user; and performing edge extraction in the target area based on the target reference point to obtain at least three target edge points.

[0026] A pixel gradient recognition is performed on each pixel point within a first preset range around the target reference point in the recognition target image to obtain a first edge point. The pixel gradient of the first edge point is greater than a preset gradient threshold. In the embodiment of the present application, performing pixel gradient recognition on each pixel point within a first preset range around the target reference point in the recognition target image can perform pixel value recognition on each pixel point within the first preset range around the target reference point in the recognition target image by a preset detection algorithm, and calculate a pixel gradient corresponding to the pixel point based on the recognized pixel value. In the practical process, 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 (edge ​​detection algorithm). In one example, performing pixel gradient recognition on each pixel point within a first preset range around the target reference point in the recognition target image can sequentially search for pixel points whose checkerboard distances from the target reference point are 0, 1, 2, ... until a first edge point is obtained, and determine whether they are edge points. The first edge point may include a plurality of pixel points.

[0027] The size of the first preset range may be set according to the actual situation. In one example, the smaller the range of the circle to be recognized, the smaller the first preset range should be, and the larger the range of the circle to be recognized, the larger the first preset range should be. For example, when the range of the image to be recognized is large but the range of the circular pattern to be recognized is small, the first preset range is set to recognize points within a small range around the target reference point. This not only allows edge points to be detected quickly, but also reduces the working memory and the amount of calculation. When the range of the circular pattern to be recognized is large, a large range around the target reference point should be recognized.

[0028] Preferably, performing pixel gradient recognition on each pixel point within a first preset range around the target reference point in the recognition target image to obtain the first edge point includes performing pixel gradient recognition on each pixel point in a plurality of preset directions within the first preset range around the target reference point in the recognition target image to obtain the first edge point. Preferably, performing pixel gradient recognition on each pixel point in a plurality of preset directions within the first preset range around the target reference point in the recognition target image to obtain the first edge point includes selecting one direction at every preset angle based on the preset reference direction within the first preset range around the target reference point in the recognition target image to obtain a plurality of target directions, and performing pixel gradient recognition on each pixel point in the preset reference direction and the plurality of target directions to obtain the first edge point. In one example, the preset direction can refer to one or more directions out of a total of eight directions, including four directions, namely, up, down, left, and right, and four directions spaced at 45° from the above four directions.

[0029] A pixel gradient recognition is performed on each pixel point within a second preset range around the first edge point to obtain a plurality of second edge points. The size of the second preset range may be the same as or different from the size of the first preset range. When detecting a plurality of second edge points within the second preset range around the first edge point, other edge points on the circumferential contour may be searched starting from the first edge point. When searching, all edge points may be searched so that the edge points are evenly arranged at each position on the circumference. The pixel gradient recognition for each pixel point within the second preset range around the first edge point may be performed by any of the above edge point detection algorithms, such as the canny algorithm.

[0030] Preferably, performing pixel gradient recognition on each pixel point within a second preset range around the first edge point to obtain a plurality of second edge points includes performing pixel gradient recognition on each pixel point in a clockwise direction and a counterclockwise direction around the first edge point within a second preset range around the first edge point to obtain a plurality of second edge points. When the radius of the circular pattern is large, sampling is performed on these edge points and only the sampled edge points are retained, thereby reducing memory consumption and the amount of subsequent calculations.

[0031] Select at least three target edge points from the first edge point and the plurality of second edge points. When fitting a circle, at least three edge points are required to fit the circle, so after obtaining the first edge point and the plurality of edge points, it is necessary to select three edge points to fit the circle. The selected at least three target edge points may be the first edge point and the plurality of second edge points, or may be at least three edge points among the second edge points. The selection of the at least three target edge points from the first edge point and the plurality of second edge points may be performed by randomly selecting three edge points from the first edge point and the plurality of second edge points as the target edge points.

[0032] Step S13: perform circle fitting based on at least three target edge points to obtain a fitted circle.

[0033] The fitting of the circle based on at least three target edge points can be performed by a plurality of preset circle fitting methods, for example, by the least squares method or the least squares method based on RANSAC, to obtain the fitted circle and circle fitting parameters, such as the radius and the circle center coordinates, etc. The circle fitting parameters are set as the parameters of the circular pattern in the recognition target image.

[0034] When selecting at least three edge points from the first edge points and the plurality of second edge points to be the target edge points, at least three edge points may be selected from the first edge points and the plurality of second edge points by a downsampling method to be the target edge points. Preferably, selecting at least three target edge points from the first edge points and the plurality of second edge points includes downsampling the plurality of second edge points to obtain at least three third sampled edge points, and fitting a circle based on the at least three target edge points to obtain the fitted circle includes fitting a circle based on the at least three third sampled edge points to obtain the fitted circle. Since the number of downsampled third edge points is smaller than the number of second edge points, downsampling may be performed based on the distance between the third edge points during downsampling so that the sampled third edge points are distributed as uniformly as possible on the fitted circle. Thus, downsampling can reduce the number of second edge points to be calculated and stored, thereby reducing memory consumption and the amount of subsequent calculations and improving fitting efficiency.

[0035] As can be seen, the method of the present embodiment allows the user to automatically recognize a first edge point and multiple second edge points by simply inputting one target reference point, and performs circle fitting by recognizing the first edge point and the second edge point to obtain the parameters of the circle in the image to be recognized, thereby simplifying the user's operation process.

[0036] Preferably, referring to FIG. 2 , the parameters of the fitted circle include the position coordinates of the fitted circle, and after fitting the circle based on at least three target edge points to obtain the fitted circle, the method further includes the following steps:

[0037] In step S21, a recognition target area is generated based on the position coordinates of the fitted circle. Step S22: Recognizing a circle in the recognition target area to obtain a recognition result, which includes parameters of the recognized circle.

[0038] Preferably, the position coordinates of the fitted circle include the center coordinates of the fitted circle and the radius of the fitted circle, and generating the recognition target area based on the position coordinates of the fitted circle includes calculating and acquiring feature parameters of the recognition target area of ​​the preset shape to be generated based on the radius of the fitted circle, the preset shape is a circle or a rectangle, the feature parameters are the radius of the circle or the length and width of the rectangle, and generating the recognition target area with the center coordinates of the fitted circle as the center of the recognition target area to be generated. When calculating and acquiring the feature parameters of the recognition target area of ​​the preset shape to be generated based on the radius of the fitted circle, the recognition target area of ​​the preset shape to be generated may include the entire fitted circle, for example, when the preset shape is a circle, the radius of the circle corresponding to the recognition target area of ​​the preset shape is larger than the radius of the fitted circle, for example, when the radius of the fitting circle is 4, the radius of the circle corresponding to the recognition target area of ​​the preset shape calculated and acquired may be 5. For example, when the radius of the fitting circle is 4, the length and width of the rectangle corresponding to the recognition target area of ​​the preset shape calculated and obtained may both be greater than twice the radius of the fitting circle; for example, when the radius of the fitting circle is 4, the length and width of the rectangle corresponding to the recognition target area of ​​the preset shape may be 9 and 10.

[0039] The target region may be a region of various shapes, for example, the target region may be a circle, annular, square, rectangular, etc. When generating the target region, the range of the target region should include the range of the circular pattern in the target image.

[0040] Preferably, performing circle recognition in the recognition target area to obtain the recognition result includes: comparing the area of ​​the recognition target area with the fitted circle; generating an updated recognition target area based on the size of the target reference point and the preset area when the ratio of the area of ​​the recognition target area with the fitted circle is greater than a preset threshold; and performing circle recognition in the updated recognition target area to obtain the recognition result. In one example, the smaller the range of the circle to be recognized, the smaller the first preset range should be, and the larger the range of the circle to be recognized, the larger the first preset range may be. For example, when the range of the recognition target image is large but the range of the circular pattern to be recognized is small, it is sufficient to recognize points within a small range around the target reference point by setting the first preset range. This allows edge points to be detected quickly, and also reduces the working memory and the amount of calculation. When the range of the circular pattern to be recognized is large, a large range around the target reference point should be recognized.

[0041] In the present embodiment, when a circular pattern is recognized in a recognition target area by a preset recognition method, the preset recognition method may be a method for performing multiple types of image recognition, such as RANSAC, etc. In the present embodiment, referring to FIG. 3, after generating an ROI based on parameters of the circular pattern, a more accurate circle detection may be performed in the ROI.

[0042] As can be seen, the method of the present embodiment can generate a recognition target area based on the position coordinates of the fitted circle, and then recognize the circle in the recognition target area to obtain the recognition result. This not only allows the recognition result to be obtained by recognizing the circular pattern in the recognition target area, and improves the accuracy of the parameters of the recognized circle, but also allows the circle to be detected in the recognition target area by selecting the recognition area, so that there is no need to perform detection in the entire image, reducing the amount of calculation and improving the calculation efficiency.

[0043] Preferably, referring to FIG. 4 , the position coordinates of the fitted circle include the center coordinates of the fitted circle and the radius of the fitted circle, and generating the recognition target area based on the position coordinates of the fitted circle includes the following steps: In step S211, the inner and outer diameters of the annular recognition target area are calculated and acquired based on the coordinates of the center of the fitted circle and the radius of the fitted circle. Step S212: based on the feature parameters, a circular recognition target region is generated based on the inner and outer diameters of the circular recognition target region, with the center being the coordinates of the center of the fitted circle.

[0044] In step S22, performing circle recognition in the recognition target region and obtaining a recognition result includes the following steps. In step S221, a circle is recognized in a circular recognition target area, and a recognition result is obtained.

[0045] Preferably, calculating and obtaining the inner and outer diameters of the annular recognition target area based on the coordinates of the center of the fitted circle and the radius of the fitted circle includes calculating the sum of the radius of the fitted circle and the width of the preset annular area to obtain the outer diameter of the recognition target area, and calculating the difference between the radius of the fitted circle and the width of the preset annular area to obtain the inner diameter of the recognition target area.

[0046] Calculating and obtaining the inner and outer diameters of the toroidal region to be generated based on the radius of the circular pattern and the preset length can be done by subtracting a preset value from the radius of the circular pattern to obtain the inner diameter of the toroidal region to be generated, and adding the preset value to the radius of the circular pattern to obtain the outer diameter of the toroidal region to be generated. Specifically, the preset value can be set according to the actual situation. In one example, the magnitude of the preset value corresponds to the radius of the circle, and the larger the radius of the circle, the larger the preset value can be, and the smaller the radius of the circle, the smaller the preset value can be. Then, a toroidal recognition target region is generated based on the inner and outer diameters of the toroidal recognition target region with the center coordinate of the fitted circle as the center. In the embodiment of the present application, the generated toroidal region includes all edge points of the circular pattern.

[0047] Recognizing a circle in a circular recognition target area and obtaining a recognition result may be performed by using the preset recognition method to recognize a circular pattern in a circular recognition target area and obtaining a recognition result. Specifically, the circular pattern may be recognized in a circular recognition target area by using an image recognition method such as the RANSAC. In the present embodiment, the recognition result may include parameters such as the radius of the circle and the coordinates of the center of the circle. The circular region includes all edge points of the circular pattern, and the area of ​​the circular region is small, so that the area to be recognized is small, and the recognition efficiency is higher.

[0048] As can be seen, the method of the present embodiment can calculate and obtain the inner and outer diameters of a circular recognition target area based on the center coordinates of the fitted circle and the radius of the fitted circle, generate a circular recognition target area based on the inner and outer diameters of the circular recognition target area with the center coordinates of the fitted circle as the center, recognize a circle in the circular recognition target area, and obtain a recognition result, thereby reducing the area to be recognized and improving the efficiency of recognition.

[0049] Please refer to FIG. 5, which is another example diagram of a circle detection method provided in the embodiment of the present application, and the circle detection method includes the following steps. 1. Setting up detection points near the circumference: In this application, the detection points are located near the circumference of the circular pattern. 2. Perform edge extraction on the image. If the image to be detected is large, but the diameter of the circle to be detected is small and occupies only a small part of the entire image area, it is possible to only extract the area near the detection point set by the user, so as to reduce the working memory and calculation amount. 3. Search for the closest edge point. Specifically, search for points whose checkerboard distance from the detection point is 0, 1, 2, etc. in sequence, or search along 8 fixed directions (the interval between two adjacent directions is 45°) to obtain points on the circumference. 4. Search for other edge points along the edge. Search in two directions, clockwise and counterclockwise, and save the edge points found. Preferably, if the radius of the circle to be searched is large, these edge points can be sampled and only the sampled edge points can be kept, which can reduce memory consumption and subsequent calculations. 5. Perform circle fitting on the edge points. Perform circle fitting on the reserved edge points. During the circle fitting, a number of different methods may be adopted, such as least squares method or least squares method based on RANSAC, and finally obtain the result of detecting the circle by this single point.

[0050] As a second embodiment of the present invention, referring to FIG. A reference point acquisition module 601 for acquiring a target reference point in a recognition target image, where the recognition target image includes a circular pattern, and the target reference point is located within a preset range of an edge of the circular pattern; an edge point selection module 602 for performing edge extraction based on the target reference point to obtain at least three target edge points; a circle fitting module 603 for fitting a circle based on the at least three target edge points to obtain a fitted circle. A circle detection device is provided.

[0051] Preferably, the edge point selection module 602 comprises: A first edge point detection module performs pixel gradient recognition on each pixel point within a first preset range around a target reference point in a recognition target image to obtain a first edge point, where the pixel gradient of the first edge point is greater than a preset gradient threshold; a second edge point detection module for performing pixel gradient recognition on each pixel point within a second preset range around the first edge point to obtain a plurality of second edge points; and a target edge point acquisition module for selecting at least three target edge points from the first edge point and the plurality of second edge points.

[0052] Preferably, the parameters of the fitted circle include position coordinates of the fitted circle, and the circle detection device further comprises: a recognition target area generation module that generates a recognition target area based on the position coordinates of the fitted circle; The recognition target area recognition module further includes: a recognition target area recognition module for performing circle recognition in the recognition target area to obtain a recognition result, where the recognition result includes parameters of the recognized circle.

[0053] Preferably, the position coordinates of the fitted circle include a center coordinate of the fitted circle and a radius of the fitted circle, and the recognition target region generating module: A feature parameter calculation module that calculates and obtains feature parameters of a recognition target area of ​​a preset shape to be generated based on a radius of the fitted circle, the preset shape being a circle or a rectangle, and the feature parameters being the radius of the circle or the length and width of the rectangle; The recognition target region generating system includes a feature parameter generating module that generates a recognition target region based on the feature parameters, with the coordinates of the center of the fitted circle set as the center of the recognition target region to be generated.

[0054] Preferably, the position coordinates of the fitted circle include a center coordinate of the fitted circle and a radius of the fitted circle, and the recognition target region generating module: an inner / outer diameter calculation submodule for calculating and obtaining an inner diameter and an outer diameter of a circular recognition target area based on the center coordinate of the fitted circle and the radius of the fitted circle; a circular region generating submodule for generating a circular recognition target region based on an inner radius and an outer radius of the circular recognition target region, the inner radius being centered on the center coordinate of the fitted circle; a recognition target area recognition module for performing circle recognition in the annular recognition target area to obtain a recognition result.

[0055] Preferably, the inner / outer diameter calculation submodule is used to calculate the sum of the radius of the fitted circle and the width of the preset annular region to obtain the outer diameter of the recognition target region, and to calculate the difference between the radius of the fitted circle and the width of the preset annular region to obtain the inner diameter of the recognition target region.

[0056] Preferably, the second edge point detection module is used to perform pixel gradient recognition for each pixel point in a clockwise direction and a counterclockwise direction of the first edge point within a second preset range around the first edge point to obtain a plurality of second edge points.

[0057] Preferably, the first edge point detection module is used for performing pixel gradient recognition for each pixel point in a plurality of preset directions within a first preset range around the target reference point in the recognition target image to obtain a first edge point.

[0058] Preferably, the first edge point detection module comprises: A direction selection submodule selects a direction every preset angle based on a preset reference direction within a first preset range around a target reference point in a recognition target image, thereby obtaining a plurality of target directions; and a pixel recognition sub-module for performing pixel gradient recognition for each pixel point in the preset reference direction and the multiple target directions to obtain a first edge point.

[0059] Preferably, the target edge point acquisition module is used for performing down-sampling on the plurality of second edge points to obtain at least three third sampling edge points; The circle fitting module is used for fitting a circle based on the at least three third sampling edge points to obtain a fitted circle.

[0060] Preferably, the recognition target area recognition module comprises: an area comparison submodule that compares the area of ​​the recognition target region with the fitted circle; a region update submodule for generating an updated recognition target region based on the target reference point and the preset region size when the ratio of the area of ​​the recognition target region to the fitted circle is greater than a preset threshold; and an updated region recognition sub-module for performing circle recognition in the updated recognition target region to obtain a recognition result.

[0061] Preferably, the edge point selection module 602 comprises: an area information receiving sub-module for receiving user recognition target area information, the recognition target area information including the size and position of the recognition target area input by the user; and a region edge extraction sub-module for performing edge extraction in the recognition target region based on the target reference point to obtain at least three target edge points.

[0062] As can be seen, the circle detection device of the embodiment of the present application can realize circle detection by the user only having to input points near the edge of a single circular pattern, which simplifies the user's operation process.

[0063] As shown in Fig. 7, the present embodiment further provides an electronic device. The electronic device includes a processor 701, a communication interface 702, a memory 703, and a communication bus 704, and the processor 701, the communication interface 702, and the memory 703 communicate with each other via the communication bus 704; The memory 703 is used to store computer programs. When the processor 701 executes a program stored in the memory 703, Obtaining a target reference point in a recognition target image, the recognition target image including a circular pattern, the target reference point being a point whose distance from an edge of the circular pattern is less than a preset distance threshold; Performing edge extraction based on the target reference point to obtain at least three target edge points; Performing circle fitting based on at least three target edge points to obtain a fitted circle.

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

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

[0066] The memory may include Random Access Memory (RAM) and Non-Volatile Memory (NVM), such as at least one magnetic disk memory. Preferably, the memory may further include at least one storage device remote from said processor.

[0067] The above-mentioned processor may be a general-purpose processor including a Central Processing Unit (CPU), a Network Processor (NP), etc., or may be a general-purpose processor including 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, or a discrete hardware assembly.

[0068] In a further embodiment of the present application, there is further provided a computer-readable storage medium having stored thereon a computer program, the computer program being adapted to, when executed by a processor, perform the steps of any of the circle detection methods described above.

[0069] In a further embodiment of the present application, there is further provided a computer program product including commands, which when executed on a computer, cause the computer to implement any of the circle detection methods in the above embodiments.

[0070] In the above embodiments, all or part of the invention may be realized by software, hardware, firmware, or any combination thereof. When realized by using software, all or part of the invention may be realized in the form of a computer program product. The computer program product includes one or more computer commands. When the computer program commands are loaded into a computer and executed, all or part of the invention may realize the flow or function according to the embodiments of the present application. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other rewritable device. The computer commands may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer commands may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, radio, microwave, etc.). The computer-readable storage medium may be any available medium that a computer can read and write, or may be a data storage device including a server, data center, etc. that has one or more available media accumulated therein. The available media may be magnetic media (eg, floppy disk, hard disk, tape), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)).

[0071] In this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not require or imply any actual relationship or sequence between these entities or operations. Additionally, the terms "comprise", "include", "includes" or any other variant thereof means "comprise" in a non-exclusive sense. Thus, a process, method, product, or device that includes a set of elements does not include only those elements, but also includes other elements not expressly listed, or further includes elements inherent in such process, method, product, or device. In the absence of further limitations, an element limited by a statement "including a ..." does not exclude the presence of other identical elements in the process, method, product, or device that includes the recited element.

[0072] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments may be cross-referenced, and the emphasis in each embodiment is on the differences from other embodiments. In particular, the embodiments of the apparatus, electronic device, storage medium, and computer program product are basically similar to the embodiments of the method, and therefore only briefly described. For related parts, please refer to the description of the embodiments of the method.

[0073] The above description is merely a preferred embodiment of the present application, and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, improvements, etc. made within the scope of the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. Obtaining a target reference point in a recognition target image, the recognition target image including a circular pattern, and the target reference point being located within a preset range of an edge of the circular pattern; Performing edge extraction based on the target reference point to obtain at least three target edge points; and fitting a circle based on the at least three target edge points to obtain a fitted circle. Circle detection method.

2. 2. A method for detecting a circle according to claim 1, comprising the steps of: The step of extracting edges based on the target reference points to obtain at least three target edge points includes: Performing pixel gradient recognition on each pixel point within a first preset range around the target reference point in the recognition target image to obtain a first edge point, where the pixel gradient of the first edge point is greater than a preset gradient threshold; performing pixel gradient recognition on each pixel point within 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. Circle detection method.

3. 3. A method for detecting a circle according to claim 2, comprising the steps of: the parameters of the fitted circle include position coordinates of the fitted circle; After performing circle fitting based on the at least three target edge points to obtain a fitted circle, the circle detection method includes: generating a recognition target area based on position coordinates of the fitted circle; performing circle recognition in the recognition target area to obtain a recognition result, the recognition result including parameters of the recognized circle. Circle detection method.

4. 4. A method for detecting a circle according to claim 3, comprising the steps of: the position coordinates of the fitted circle include the center coordinates of the fitted circle and the radius of the fitted circle; Generating a recognition target region based on position coordinates of the fitted circle Calculating and acquiring feature parameters of a recognition target area of ​​a preset shape to be generated based on a radius of the fitted circle, the preset shape being a circle or a rectangle, and the feature parameters being the radius of the circle or the length and width of the rectangle; generating a recognition target area based on the feature parameters, with the coordinates of the center of the fitted circle set as the center of the recognition target area to be generated. Circle detection method.

5. 4. A method for detecting a circle according to claim 3, comprising the steps of: the position coordinates of the fitted circle include the center coordinates of the fitted circle and the radius of the fitted circle; Generating a recognition target region based on position coordinates of the fitted circle calculating and acquiring an inner radius and an outer radius of a circular recognition target area based on the center coordinates of the fitted circle and the radius of the fitted circle; generating a circular recognition target region based on an inner diameter and an outer diameter of the circular recognition target region, with the circular center coordinate of the fitted circle as a center; Recognizing a circle in the recognition target area and obtaining a recognition result includes: performing circle recognition in the annular recognition target area to obtain a recognition result; Circle detection method.

6. 6. A method for detecting a circle according to claim 5, comprising the steps of: Calculating and acquiring an inner radius and an outer radius of a circular recognition target area based on the center coordinates of the fitted circle and the radius of the fitted circle, Calculating the sum of the radius of the fitted circle and the width of a preset annular region to obtain an outer diameter of a recognition target region; and calculating the difference between the radius of the fitted circle and the width of the preset annular region to obtain an inner diameter of the recognition target region. Circle detection method.

7. 3. A method for detecting a circle according to claim 2, comprising the steps of: performing pixel gradient recognition on each pixel point within a second preset range around the first edge point to obtain a plurality of second edge points; and performing pixel gradient recognition on each pixel point in a clockwise direction and a counterclockwise direction of the first edge point within a second preset range around the first edge point to obtain the plurality of second edge points. Circle detection method.

8. 3. A method for detecting a circle according to claim 2, comprising the steps of: performing pixel gradient recognition on each pixel point within a first preset range around a target reference point in the recognition target image to obtain a first edge point; performing pixel gradient recognition for each pixel point in a plurality of preset directions within a first preset range around a target reference point in the recognition target image to obtain a first edge point; Circle detection method.

9. 9. A method for detecting a circle according to claim 8, comprising the steps of: performing pixel gradient recognition on each pixel point in a plurality of preset directions within a first preset range around a target reference point in the recognition target image to obtain a first edge point; Selecting a direction every preset angle based on a preset reference direction within a first preset range around a target reference point in the recognition target image to obtain a plurality of target directions; performing pixel gradient recognition for each pixel point in the preset reference direction and the plurality of target directions to obtain a first edge point. Circle detection method.

10. 3. A method for detecting a circle according to claim 2, comprising the steps of: Selecting 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 sampled edge points; Fitting a circle based on the at least three target edge points to obtain a fitted circle includes: and fitting a circle based on the at least three third sampled edge points to obtain the fitted circle. Circle detection method.

11. 4. A method for detecting a circle according to claim 3, comprising the steps of: Recognizing a circle in the recognition target area and obtaining a recognition result includes: comparing the area of ​​the recognition target region with the fitted circle; generating an updated recognition target region based on the target reference point and a preset region size when the ratio of the area of ​​the recognition target region to the fitted circle is greater than a preset threshold; performing circle recognition in the updated recognition target area to obtain a recognition result. Circle detection method.

12. 2. A method for detecting a circle according to claim 1, comprising the steps of: The step of extracting edges based on the target reference points to obtain at least three target edge points includes: receiving user recognition target area information, the recognition target area information including a size and a position of the recognition target area input by the user; and performing edge extraction in the recognition target area based on the target reference point to obtain at least three target edge points. Circle detection method.

13. a reference point acquisition module for acquiring a target reference point in a recognition target image, the recognition target image including a circular pattern, and the target reference point being located within a preset range of an edge of the circular pattern; A first edge point detection module performs pixel gradient recognition on each pixel point within a first preset range around a target reference point in the recognition target image to obtain a first edge point, where the pixel gradient of the first edge point is greater than a preset gradient threshold; a second edge point detection module for performing pixel gradient recognition on each pixel point within a second preset range around the first edge point to obtain a plurality of second edge points; a target edge point acquisition module for selecting at least three target edge points from the first edge point and the plurality of second edge points; and a circle fitting module for fitting a circle based on the at least three target edge points to obtain a fitted circle. Circle detector.

14. An electronic device including a processor, a communication interface, a memory, and a communication bus, the processor, the communication interface, and the memory communicating with each other via the communication bus; The memory is used to store computer programs. An electronic device, wherein a processor is used to implement the steps of the circle detection method according to any one of claims 1 to 12 when the processor executes a program stored in a memory.

15. A computer readable storage medium having a computer program stored thereon, the computer program being configured to implement the steps of the circle detection method according to any one of claims 1 to 12 when executed by a processor.

Citation Information

Patent Citations

  • Circle detection method and device

    CN102236894A

  • Cover defect detection method based on image processing

    CN106251352A

  • Image processing apparatus, image processing method, image processing program, and defect detection apparatus

    JP2011227748A

  • Image identification device, method, and program

    JP2021096652A