image = | houghLinesGradient2dImg (inGxGreyImg2d,inGyGreyImg2d) |
image = | houghLinesGradient2dImg (inGxGreyImg2d,inGyGreyImg2d,houghLinesImgParams,orientationTolerance) |
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
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)
rhoStep = 2.0
thetaRange = PyIPSDK.createEvenlySpacedRange(math.pi/2, 3*math.pi/4, 15)
intensityThreshold = 70.0
imgParams = PyIPSDK.createHoughLinesGradientImgParams(
rhoStep, thetaRange, intensityThreshold)
orientationTolerance = math.pi/18
outImg = fd.houghLinesGradient2dImg(
gxImg, gyImg, imgParams, orientationTolerance)
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLFeatureDetection/Processor/HoughLinesGradient2dImg/HoughLinesGradient2dImg.h>
Code Example
GradientXYImg xyImg = sobelGradient2dImg(pInImg);
const ipReal64 rhoStep = 1.0;
M_PI / 2, 3 * M_PI / 4, 15);
const ipReal32 intensityThreshold = 10.0f;
rhoStep, thetaRange, intensityThreshold);
const ipReal32 orientationTolerance = static_cast<ipReal32>(M_PI / 18);
const ImageConstPtr pOutImg = houghLinesGradient2dImg(
xyImg._pXGradImg,
xyImg._pYGradImg,
pInHoughImgPrms,
orientationTolerance);