IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Computation of complex accumulator matrix for Hough circles detection

computes the complex accumulator matrix used by the Hough circles detector ("gradient phase-coded" method) More...

IPSDKIPLFEATUREDETECTION_API HoughCirclesComplexImg ipsdk::imaproc::fd::houghCirclesPhaseCoded2dImg (const image::ImageConstPtr &pInGxImg, const image::ImageConstPtr &pInGyImg, const ipsdk::imaproc::attr::HoughCirclesRadiusRangeConstPtr &pRadiusRange)
 wrapper function for detects circles in images of gradient using Hough algorithm More...
 
IPSDKIPLFEATUREDETECTION_API void ipsdk::imaproc::fd::houghCirclesPhaseCoded2dImg (const image::ImageConstPtr &pInGxImg, const image::ImageConstPtr &pInGyImg, const ipsdk::imaproc::attr::HoughCirclesRadiusRangeConstPtr &pRadiusRange, const ipsdk::imaproc::attr::eCircleIntensityType &eCircleIntensityType, const ipReal64 maxAngleWithGradDir, const ipUInt32 nbMaxPtsPerCircle, const image::ImagePtr &pOutRealImg, const image::ImagePtr &pOutImImg)
 wrapper function for detects circles in images of gradient using Hough algorithm More...
 

Detailed Description

computes the complex accumulator matrix used by the Hough circles detector ("gradient phase-coded" method)

This algorithm computes, from the 2 gradient images (respectively along x and y axis) of the same grey levels 2d image, the complex accumulator matrix used to detect circles in an image, using Hough algorithm ("gradient phase-coded" 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:

houghCirclesPhaseCoded2dImg.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InGxGreyImg2d [Input] 2d grey levels image of gradient computed along x-axis X
ipsdk::imaproc::attr::InGyGreyImg2d [Input] 2d grey levels image of gradient computed along y-axis X
ipsdk::imaproc::attr::InOptCircleIntensityType [Input Optional] circle intensity type for detection algorithms X
ipsdk::imaproc::attr::InOptMaxAngleWithGradDir [Input Optional] maximum angle with gradient direction, in radians X
ipsdk::imaproc::attr::InOptNbMaxPtsPerCircle [Input Optional] maximum number of points per circle X
ipsdk::imaproc::attr::InOptHoughCirclesRadiusRange [Input Optional] range of radius of circles to detect using Hough circles algorithm X
ipsdk::imaproc::attr::OutComplexRealImg [Output Optional] Real part of the complex image resulting from Hough circles detection ipsdk::imaproc::duplicateInOut (_pOutComplexRealImg, _pInGxGreyImg2d, ipsdk::image::eImageBufferType::eIBT_Real32)
ipsdk::imaproc::attr::OutComplexImImg [Output Optional] Imaginary part of the complex image resulting from Hough circles detection ipsdk::imaproc::duplicateInOut (_pOutComplexImImg, _pInGxGreyImg2d, ipsdk::image::eImageBufferType::eIBT_Real32)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSizeAndType (_pInGxGreyImg2d,_pInGyGreyImg2d) && 
ipsdk::imaproc::matchSize (_pInGxGreyImg2d,_pOutComplexRealImg,_pOutComplexImImg) && 
ipsdk::imaproc::matchSizeAndType (_pOutComplexRealImg,_pOutComplexImImg) && ipsdk::imaproc::matchSize<ipsdk::imaproc::attr::HoughCirclesRadiusRange::MaxRadius>(ipsdk::imaproc::eMatchImageSizeType::eMIST_2d,ipsdk::imaproc::eMatchImageSizeScale::eMISS_HalfSize,_pInGxGreyImg2d,_pInOptHoughCirclesRadiusRange)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFeatureDetection as fd
import PyIPSDK.IPSDKIPLFiltering as filter

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# associated gradient images computation
gxImg, gyImg = filter.gaussianGradient2dImg(inImg, 1.0)
# radius range detection definition
radiusRange = PyIPSDK.createHoughCirclesRadiusRange(15, 20)
# hough circle phase coded detection computation
outRealImg, outImImg = fd.houghCirclesPhaseCoded2dImg(gxImg, gyImg, radiusRange)

Example of C++ code :

Example informations

Associated library

IPSDKIPLFeatureDetection

Header file

Code Example

#include <IPSDKImage/Image/Memory/MemoryImage.h>
#include <utility>
// function returning the complex accumulation image (one image for real part
// + one image for imaginary part) used by Hough circle detector
// ("gradient phase-coded" method) applied on an input image loaded from a given
// file to detect circles of radii belonging to a given range
std::pair<ipsdk::image::ImagePtr, ipsdk::image::ImagePtr>
computeHoughCirclesPhaseCoded2dImages(
const std::string& inImgFilePath,
ipUInt64 nMinRadius,
ipUInt64 nMaxRadius)
{
// load input image from file specified by the user
// compute gradient images, in x and y
GradientXYImg gxyImg =
gaussianGradient2dImg(pInImg, 1.0f, 1.0f, createGaussianCoverage(0.997f, 2));
ImagePtr pInGxImg = gxyImg._pXGradImg;
ImagePtr pInGyImg = gxyImg._pYGradImg;
// apply Hough circles detection on gradient images
HoughCirclesComplexImg hcComplexImg =
pInGxImg,
pInGyImg,
// return the accumulation image
return std::make_pair(hcComplexImg._pRealImg, hcComplexImg._pImImg);
}
See also
HoughCirclesPhaseCoded2dImgLvl1
HoughCirclesPhaseCoded2dImgLvl2
HoughCirclesPhaseCoded2dImgLvl3

Function Documentation

◆ houghCirclesPhaseCoded2dImg() [1/2]

IPSDKIPLFEATUREDETECTION_API HoughCirclesComplexImg ipsdk::imaproc::fd::houghCirclesPhaseCoded2dImg ( const image::ImageConstPtr pInGxImg,
const image::ImageConstPtr pInGyImg,
const ipsdk::imaproc::attr::HoughCirclesRadiusRangeConstPtr pRadiusRange 
)

wrapper function for detects circles in images of gradient using Hough algorithm

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ houghCirclesPhaseCoded2dImg() [2/2]

IPSDKIPLFEATUREDETECTION_API void ipsdk::imaproc::fd::houghCirclesPhaseCoded2dImg ( const image::ImageConstPtr pInGxImg,
const image::ImageConstPtr pInGyImg,
const ipsdk::imaproc::attr::HoughCirclesRadiusRangeConstPtr pRadiusRange,
const ipsdk::imaproc::attr::eCircleIntensityType eCircleIntensityType,
const ipReal64  maxAngleWithGradDir,
const ipUInt32  nbMaxPtsPerCircle,
const image::ImagePtr pOutRealImg,
const image::ImagePtr pOutImImg 
)

wrapper function for detects circles in images of gradient using Hough algorithm

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure