image = | houghCircles2dImg (inGxImg,inGyImg,radiusRange) |
computes the accumulator matrix used by the Hough circles detector ("gradient" method)
This algorithm computes, from the 2 gradient images (respectively along x and y axis) of the same grey levels 2d image, the accumulator matrix used to detect circles in an image, using Hough algorithm ("gradient" method).
See Hough circles detection for more information.
Below is an example of image returned by the algorithm on gradient images computed from an image of coins. We can see that positions of high local maxima in accumulation matrix correspond to positions of centers of circles in the original image:
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLFeatureDetection as fd
import PyIPSDK.IPSDKIPLFiltering as filter
Code Example
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
gxImg, gyImg = filter.gaussianGradient2dImg(inImg, 1.0)
radiusRange = PyIPSDK.createHoughCirclesRadiusRange(15, 20)
outImg = fd.houghCircles2dImg(gxImg, gyImg, radiusRange)
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLFeatureDetection/Processor/HoughCircles2dImg/HoughCircles2dImg.h>
Code Example
#include <IPSDKImageFile/Tiff/TiffImageFileUtils.h>
#include <IPSDKIPL/IPSDKIPLFeatureDetection/Processor/HoughCircles2dImg/HoughCircles2dImg.h>
ImagePtr
computeHoughCircles2dImage(
const std::string& inImgFilePath,
ipUInt64 nMinRadius,
ipUInt64 nMaxRadius)
{
ipsdk::image::ImagePtr pInImg =
GradientXYImg gxyImg =
ImagePtr pInGxImg = gxyImg._pXGradImg;
ImagePtr pInGyImg = gxyImg._pYGradImg;
ImagePtr pAccumulationImg =
ipsdk::imaproc::fd::houghCircles2dImg(
pInGxImg,
pInGyImg,
return pAccumulationImg;
}