This application claims priority from Korean Patent Application No. 10-2016-0026433, filed on Mar. 4, 2016, in the Korean Intellectual Property Office, the disclosure of which is incorporated herein by reference in its entirety.
1. Field
The following description relates to pattern recognition technology, and more particularly, to an apparatus and method for detecting a circle which are frequently used in various computer vision fields such as virtual sports, facial recognition, and so on.
2. Description of Related Art
Circle detection technology is necessary for a preprocessing operation in various computer vision fields, such as virtual sports simulation, pupil recognition, etc., and much research is underway to develop a high speed hardware engine for real-time processing of the circle detection technology.
In particular, a virtual sports simulation in which a high-speed camera is used requires circle detection technology having a high speed of several milliseconds or less, but most existing techniques do not satisfy requirements for such processing performance.
Generally, a circle detector using a Hough transform performs an edge detection operation and a voting operation based on the Hough transform.
The edge detection operation includes a total of four operations (filtering, gradation, non-maximum suppression, and hysteresis thresholding). The gradation operation requires calculation of H(x, y)=Σi=0M
to calculate an angle. Here, calculation of a trigonometric function and a division operation implemented by hardware do not only degrade performance but also require a large area, and thus are not appropriate for hardware implementation.
The voting operation has been extensively researched to reduce time complexity or hardware costs. From the research, according to an incremental circle Hough transform (ICHT) which has been developed recently, a circle is calculated in the form of a Taylor series to avoid using a trigonometric function like in a coordinate rotation digital computer (CORDIC) algorithm, but there is a considerably large error when dθ is small. Also, since a current value is calculated using a previous value, there is a continuous dependency on previous data, and parallel processing is not possible through hardware implementation. Further, when a circle is expressed, many points of the circle may be shown as one pixel, and in this case, a central point of the circle may be incorrectly selected.
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.
The following description relates to a hardware-based apparatus and method for detecting a circle using a Hough transform which reduce costs and time complexity for calculation and thus can be implemented by hardware.
The following description also relates to a hardware-based apparatus and method for detecting a circle in which parallel calculation is used for real-time processing.
In one general aspect, an apparatus for detecting a circle includes: an edge detector configured to generate a foreground image from a background image generated from an input image and generate edge pixel information from the foreground image; and a voting processor configured to calculate a position of a central point and a radius of a circle by performing a circle Hough transform using the edge pixel information.
In another general aspect, a method of detecting a circle includes: generating a foreground image from a background image generated from an input image and generating edge pixel information from the foreground image; and calculating a position of a central point and a radius of a circle by performing a circle Hough transform using the edge pixel information.
Other features and aspects will be apparent from the following detailed description, the drawings, and the claims.
Throughout the drawings and the detailed description, unless otherwise described, the same drawing reference numerals should be understood as referring to the same elements, features, and structures. The relative size and depiction of these elements may be exaggerated for clarity, illustration, and convenience.
The following description is provided to assist the reader in gaining a comprehensive understanding of the methods, apparatuses, and/or systems described herein. Accordingly, various changes, modifications, and equivalents of the methods, apparatuses, and/or systems described herein will be proposed to those of ordinary skill in the art. Also, descriptions of well-known functions and constructions may be omitted for increased clarity and conciseness. Throughout the drawings, like reference numbers refer to like elements.
The terms used in the following description are terms defined in consideration of functions in exemplary embodiments of the present invention and may vary depending on an intention of a user or an operator, a practice, and so on. Therefore, definitions of terms used herein should be made based on the content throughout the specification.
Referring to
Here, the external memory 20 is a general dynamic random access memory (DRAM) (a display data RAM (DDRAM), a double data rate type 2 (DDR2) DRAM, a double data rate type 3 (DDR3) DRAM, etc.) which is slower than an internal memory (a static RAM (SRAM)) but has a large capacity. Therefore, a high-capacity camera image is stored in the external memory and then input to the edge detector 100, and a final result of a Hough transform performed by the voting processor 200 becomes an output of the external memory 10.
The edge detector 100 generates a foreground image from a background image generated from the input image and generates edge pixel information from the foreground image. The edge detector 100 will be described in detail below with reference to
Because there are not many edge pixels, the edge pixel information generated by the edge detector 100 is stored in the edge list memory 20 which is in the form of an internal memory.
The voting processor 200 performs a circle Hough transform using the edge pixel information generated by the edge detector 100, thereby calculating a position of a central point and a radius of a circle. The edge detector 100 will be described in detail below with reference to
Referring to
The background image generator 110 generates a background image from an input image and stores the background image in the internal memory 120. Referring to
From the generated background image, the foreground/background separator 130 acquires a foreground mask image, that is, it generates a foreground image of the input image having a different value, which is a predetermined threshold or more, from the background image. In other words, [Equation 1] below is used to extract the foreground image.
In [Equation 1], Fi,j is an output foreground image, Ii,j is an input image, Bi,j is a background image, and Td is a set threshold. Ranges of i and j become a width and a height of a two-dimensional (2D) image. For example, when the input image has a video graphics array (VGA) resolution of 640×480, its width is 640 and its height is 480. Also, i and j may be any of the width and the height, and the ranges are not limited. Td may change according to a color range of the input image. For example, in an image of 8-bit colors having values of 0 to 255, Td may be 0 to 255. In other words, the value of Td may be defined within a color range of an input image. Also, Td is a threshold, and a parameter determined according to a user or an environment. Td may not be determined as an extreme value, such as 0 or 255, but may be determined within a range of 50 to 100.
The edge generator 140 obtains edge pixels from the foreground image and stores the position values in the edge list memory 20. Here, the edge pixels are calculated from the foreground image by [Equation 2] below.
Referring to
The edge reader 210 reads information on the edge pixels from the edge list memory 20.
The raster unit 220 performs a circle Hough transform using the edge pixel information output by the edge reader 210, thereby calculating a position of a central point and a radius of a circle. Specifically, the raster unit 220 includes a plurality of vectored edge generators (VEGs) 231-1 to 231-4, a plurality of voting value calculators 232-1 to 232-4, and a controller 233.
The controller 233 sets a radius of a circle which will be subjected to voting processing. Here, a range of a radius r of the circle may be appropriately selected by the user or may be effectively applied using a labeling technique which is widely used in pattern recognition. According to the labeling technique, a range of a region determined to be each object is set and labelled, and a portion which is not determined to be an object is removed. A range of the radius may be defined by a minimum radius and a maximum radius.
Each of the four VEGs 231-1 to 231-4 simultaneously generates vectored edges (VEs) centered on an edge pixel position. Each of the VEGs 231-1 to 231-4 performs a calculation corresponding to an angle of π/8 (0° to 22.5°, 22.5° to 45°, 45° to 67.5°, and 67.5° to 90°). When the circle has a small radius, dtθ may be set to reduce calculation costs as shown in [Equation 3] below.
According to an exemplary embodiment, there are the four VEGs, and thus n may be
in [Equation 3]. According to an exemplary embodiment, the raster unit 220 may acquire a trigonometric function value previously stored in the trigonometric function value table 230 through the register 240 and use the trigonometric function value in a calculation.
The voting value calculators 232-1 to 232-4 calculate voting values for each of the VEs generated by the VEGs 231-1 to 231-4. When many VEs extend over one pixel, an incorrect position may be selected as the center of the circle, and thus 8×8 super-sampling is used according to an exemplary embodiment. A super-sampling pattern may vary. This will be described with reference to
Referring to
Side=(V0y−V1y)×(SPx−V0x)+(V1x−V0x)×(SPy−V0y)
Flag=Flag+1, if side<0 [Equation 4]
Referring to
When the voting value calculators 232-1 to 232-4 calculate all voting values for a single edge, the VEGs 231-1 to 231-4 generate new VEs, and the voting value calculators 232-1 to 232-4 calculate voting values for the new VEs. The VEGs 231-1 to 231-4 and the voting value calculators 232-1 to 232-4 repeat such operations until all VEs for the radius are processed.
When all VEs for the set radius are processed by the VEGs 231-1 to 231-4 and the voting value calculators 232-1 to 232-4, the controller 233 sets a new radius by adding 1 to the current radius and controls the VEGs 231-1 to 231-4 and the voting value calculators 232-1 to 232-4 to calculate voting values for the new radius.
The voting processor 200 performs the above described operations for all edge pixels of the image.
Referring to
Referring to
From the generated background image, the apparatus for detecting a circle acquires a foreground mask image (S820), that is, it generates a foreground image of the input image having a different value, which is a predetermined threshold or more, from the background image. In other words, [Equation 1] above is used to extract the foreground image.
The apparatus for detecting a circle generates edge pixels from the foreground image (S830). Here, the edge pixels are calculated from the foreground image by [Equation 2] above.
Referring to
Subsequently, the apparatus for detecting a circle determines the number of VEs (S930), and generates VEs centered on an edge pixel position (S940). According to an exemplary embodiment, when the number of VEs is determined to be 4, the apparatus for detecting a circle simultaneously generates four VEs centered on the edge pixel position. In other words, the apparatus for detecting a circle simultaneously performs calculations corresponding to an angle of π/8 (0° to 22.5°, 22.5° to 45°, 45° to 67.5°, and 67.5° to 90°) in parallel. When the circle has a small radius, dtθ may be set to reduce calculation costs as shown in [Equation 3] above.
The apparatus for detecting a circle calculates voting values for each of the generated VEs (S950). When many VEs extend over one pixel, an incorrect position may be selected as the center of the circle, and thus 8×8 super-sampling is used according to an exemplary embodiment. A super-sampling pattern may vary.
The apparatus for detecting a circle determines whether calculations of all voting values for a single VE have been finished (S960).
When it is determined in S960 that calculations of all voting values for the single VE have not been finished, the apparatus for detecting a circle performs S950 again. On the other hand, when it is determined in S960 that the calculations of all voting values for the single VE have been finished, the apparatus for detecting a circle determines whether all VEs for the set radius have been processed (S970).
When it is determined in S970 that all of the VEs for the set radius have not been processed, the process goes back to S940, and the apparatus for detecting a circle generates a new VE (S940), and calculates voting values for the new VE (S950). S940 and S950 are repeated until all of the VEs for the set radius are processed. On the other hand, when it is determined in S970 that all of the VEs for the set radius have been processed, the apparatus for detecting a circle determines whether a cone for the edge pixels has been completed (S980).
When it is determined in S980 that the cone for the edge pixels has not been completed, the process goes back to S920, and the apparatus for detecting a circle sets a new radius by adding 1 to the previously set radius (S920). Subsequently, the apparatus for detecting a circle performs S930 to S970 to calculate voting values for the new radius. On the other hand, when it is determined in S980 that the cone for the edge pixels has been completed, the apparatus for detecting a circle determines whether all of the edge pixels of the input image have been processed (S990).
When it is determined in operation S990 that all of the edge pixels of the input image have not been processed, the process goes back to S910, and the apparatus for detecting a circle performs S910 to S980 again.
According to the present invention, it is possible to calculate a radius and a position of a circle from a grayscale image.
According to the present invention, separate histograms are generated in units of scan lines to obtain a background image from a cumulative probability distribution and separate a foreground image and the background image from each other, so that an edge may be detected through only addition/subtraction operations without complex calculation. Also, since calculation is performed in units of scan lines, parallel calculation is possible.
During voting processing of the present invention, a trigonometric function value which is previously calculated in a preprocessing operation is used so that no trigonometric function calculator is used. Also, a circle Hough transform with high accuracy is enabled through vectorization and super-sampling.
Further, since all calculations are separately performed, parallel calculation is possible which helps improve system performance.
A number of examples have been described above. Nevertheless, it should be understood that various modifications may be made. For example, suitable results may be achieved if the described techniques are performed in a different order and/or if components in a described system, architecture, device, or circuit are combined in a different manner and/or replaced or supplemented by other components or their equivalents. Accordingly, other implementations are within the scope of the following claims.
Number | Date | Country | Kind |
---|---|---|---|
10-2016-0026433 | Mar 2016 | KR | national |