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

computes the accumulator matrix used by the Hough lines detector from gradient images More...

IPSDKIPLFEATUREDETECTION_API image::ImagePtr ipsdk::imaproc::fd::houghLinesGradient2dImg (const image::ImageConstPtr &pInGxGreyImg2d, const image::ImageConstPtr &pInGyGreyImg2d)
 wrapper function for computation of accumulator matrix of extended Hough lines detector detector, from 2 images of gradient (one along x-axis, the other along y) More...
 
IPSDKIPLFEATUREDETECTION_API image::ImagePtr ipsdk::imaproc::fd::houghLinesGradient2dImg (const image::ImageConstPtr &pInGxGreyImg2d, const image::ImageConstPtr &pInGyGreyImg2d, const ipsdk::imaproc::attr::HoughLinesGradientImgParamsConstPtr &pHoughLinesImgParams, const ipsdk::ipReal32 orientationTolerance)
 wrapper function for computation of accumulator matrix of extended Hough lines detector detector, from 2 images of gradient (one along x-axis, the other along y) More...
 

Detailed Description

computes the accumulator matrix used by the Hough lines detector from gradient images

detection from gradient images

This algorithm computes, from a grey level 2d image, the accumulation matrix used to detect straight lines in the input image, using the implemented extension of Hough transform based on gradient orientation.

See HoughLinesGradient2d for more information

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::InOptHoughLinesGradientImgParams [Input Optional] Parameters for Hough lines detection algorithm using 2 input gradient images X
ipsdk::imaproc::attr::InOptHoughLinesOrientationTolerance [Input Optional] Tolerance for orientation around estimated gradient direction X
ipsdk::imaproc::attr::OutRealImg [Output] image for processing operation (data contained in image buffer are reals) customOutput (_pOutRealImg, outputHoughLinesGradient2dImg(_pInGxGreyImg2d,_pInOptHoughLinesGradientImgParams))

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSizeAndType (_pInGxGreyImg2d,_pInGyGreyImg2d) && 
ipsdk::imaproc::customImageProperty (_pOutRealImg,
 ipsdk::imaproc::fd::houghLines2dCheckOutImgSzXEquals (_pInGxGreyImg2d,_pInOptHoughLinesGradientImgParams)) && 
ipsdk::imaproc::customImageProperty (_pOutRealImg,
 ipsdk::imaproc::fd::houghLines2dCheckOutImgSzYEquals (_pInGxGreyImg2d,_pInOptHoughLinesGradientImgParams)) && 
ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_T,_pInGxGreyImg2d,_pOutRealImg) && 
ipsdk::imaproc::matchVolumeGeometryType (_pInGxGreyImg2d,_pOutRealImg) && 
ipsdk::imaproc::matchColorGeometryType (_pInGxGreyImg2d,_pOutRealImg) && 
ipsdk::imaproc::noInSitu (_pInGxGreyImg2d,_pOutRealImg)

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)
# compute images of gradient along each axis, applying a gaussian gradient with
# sigma=1
gxImg, gyImg = filter.gaussianGradient2dImg(inImg, 1.0)
# Initialize parameters for Hough lines accumulation matrix construction:
# - step for rho = 1
rhoStep = 2.0
# - range of 15 evenly spaced orientations between pi/2 and 3.pi/4 radians
thetaRange = PyIPSDK.createEvenlySpacedRange(math.pi/2, 3*math.pi/4, 15)
# only accumulate pixels of input image with intensity greater than 70
intensityThreshold = 70.0
imgParams = PyIPSDK.createHoughLinesGradientImgParams(
rhoStep, thetaRange, intensityThreshold)
# orientation tolerance = 10 degrees (pi / 18 radians)
orientationTolerance = math.pi/18
# hough circle detection computation
outImg = fd.houghLinesGradient2dImg(
gxImg, gyImg, imgParams, orientationTolerance)

Example of C++ code :

Example informations

Associated library

IPSDKIPLFeatureDetection

Header file

Code Example

ImageConstPtr pInImg = loadTiffImageFile(inImgPath);
GradientXYImg xyImg = sobelGradient2dImg(pInImg);
// Initialize parameters for Hough lines accumulation matrix construction:
// - step for rho = 1
const ipReal64 rhoStep = 1.0;
// - range of 15 evenly spaced orientations between pi/2 and 3.pi/4 radians
const EvenlySpacedRange& thetaRange = *createEvenlySpacedRange(
M_PI / 2, 3 * M_PI / 4, 15);
// only accumulate pixels of input image with intensity greater than 10
const ipReal32 intensityThreshold = 10.0f;
const HoughLinesGradientImgParamsConstPtr pInHoughImgPrms =
rhoStep, thetaRange, intensityThreshold);
// Initialize orientation tolerance parameter to 10 degrees (pi/18 radians)
const ipReal32 orientationTolerance = static_cast<ipReal32>(M_PI / 18);
// launch Hough lines detection algorithm
xyImg._pXGradImg,
xyImg._pYGradImg,
pInHoughImgPrms,
orientationTolerance);
See also
HoughLinesGradient2dImgLvl1
HoughLinesGradient2dImgLvl2
HoughLinesGradient2dImgLvl3

Function Documentation

◆ houghLinesGradient2dImg() [1/2]

IPSDKIPLFEATUREDETECTION_API image::ImagePtr ipsdk::imaproc::fd::houghLinesGradient2dImg ( const image::ImageConstPtr pInGxGreyImg2d,
const image::ImageConstPtr pInGyGreyImg2d 
)

wrapper function for computation of accumulator matrix of extended Hough lines detector detector, from 2 images of gradient (one along x-axis, the other along y)

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ houghLinesGradient2dImg() [2/2]

IPSDKIPLFEATUREDETECTION_API image::ImagePtr ipsdk::imaproc::fd::houghLinesGradient2dImg ( const image::ImageConstPtr pInGxGreyImg2d,
const image::ImageConstPtr pInGyGreyImg2d,
const ipsdk::imaproc::attr::HoughLinesGradientImgParamsConstPtr pHoughLinesImgParams,
const ipsdk::ipReal32  orientationTolerance 
)

wrapper function for computation of accumulator matrix of extended Hough lines detector detector, from 2 images of gradient (one along x-axis, the other along y)

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure