NVIDIA 2D Image And Signal Performance Primitives (NPP)  Version 11.5.0.*
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
FilterHoughLine

Extracts Hough lines from a single channel 8-bit binarized (0, 255) source feature (canny edges, etc.) image. More...

Functions

NppStatus nppiFilterHoughLineGetBufferSize (NppiSize oSizeROI, NppPointPolar nDelta, int nMaxLineCount, int *hpBufferSize)
 Calculate scratch buffer size needed for the FilterHoughLine or FilterHoughLineRegion functions based on destination image SizeROI width and height and nDelta parameters. More...
 
NppStatus nppiFilterHoughLine_8u32f_C1R_Ctx (const Npp8u *pSrc, int nSrcStep, NppiSize oSizeROI, NppPointPolar nDelta, int nThreshold, NppPointPolar *pDeviceLines, int nMaxLineCount, int *pDeviceLineCount, Npp8u *pDeviceBuffer, NppStreamContext nppStreamCtx)
 1 channel 8-bit unsigned binarized (0, 255) source feature (canny edges, etc.) source image to list of lines in point polar format representing the length (rho) and angle (theta) of each line from the origin of the normal to the line using the formula rho = x cos(theta) + y sin(theta). More...
 
NppStatus nppiFilterHoughLine_8u32f_C1R (const Npp8u *pSrc, int nSrcStep, NppiSize oSizeROI, NppPointPolar nDelta, int nThreshold, NppPointPolar *pDeviceLines, int nMaxLineCount, int *pDeviceLineCount, Npp8u *pDeviceBuffer)
 
NppStatus nppiFilterHoughLineRegion_8u32f_C1R_Ctx (const Npp8u *pSrc, int nSrcStep, NppiSize oSizeROI, NppPointPolar nDelta, int nThreshold, NppPointPolar *pDeviceLines, NppPointPolar oDstROI[2], int nMaxLineCount, int *pDeviceLineCount, Npp8u *pDeviceBuffer, NppStreamContext nppStreamCtx)
 1 channel 8-bit unsigned binarized (0, 255) source feature (canny edges, etc.) source image to list of lines in point polar format representing the length (rho) and angle (theta) of each line from the origin of the normal to the line using the formula rho = x cos(theta) + y sin(theta). More...
 
NppStatus nppiFilterHoughLineRegion_8u32f_C1R (const Npp8u *pSrc, int nSrcStep, NppiSize oSizeROI, NppPointPolar nDelta, int nThreshold, NppPointPolar *pDeviceLines, NppPointPolar oDstROI[2], int nMaxLineCount, int *pDeviceLineCount, Npp8u *pDeviceBuffer)
 

Detailed Description

Extracts Hough lines from a single channel 8-bit binarized (0, 255) source feature (canny edges, etc.) image.

Outputs a list of lines in point polar format representing the length (rho) and angle (theta) of each line from the origin of the normal to the line using the formula rho = x cos(theta) + y sin(theta). The level of discretization, nDelta, is specified as an input parameter. The performance and effectiveness of this function highly depends on this parameter with higher performance for larger numbers and more detailed results for lower numbers. Also, lines are not guaranteed to be added to the pDeviceLines list in the same order from one call to the next. However, all of the same lines will still be generated as long as nMaxLineCount is set large enough so that they all can fit in the list. To convert lines in point polar format back to cartesian lines use the following formula:

*
* Npp32f nHough = ((sqrt(2.0F) * static_cast<Npp32f>(oSizeROI.height > oSizeROI.width ? oSizeROI.height
* : oSizeROI.width)) / 2.0F);
* int nAccumulatorsHeight = nDelta.rho > 1.0F ? static_cast<int>(ceil(nHough * 2.0F))
* : static_cast<int>(ceil((nHough * 2.0F) / nDelta.rho));
* int nCenterX = oSizeROI.width >> 1;
* int nCenterY = oSizeROI.height >> 1;
* Npp32f nThetaRad = static_cast<Npp32f>(deviceline.theta) * 0.0174532925199433F;
* Npp32f nSinTheta = sin(nThetaRad);
* Npp32f nCosTheta = cos(nThetaRad);
* int nX1, nY1, nX2, nY2;
*
* if (deviceline.theta >= 45 && deviceline.theta <= 135) // degrees
* {
* // y = (rho - x cos(theta)) / sin(theta)
* nX1 = minimum cartesian X boundary value;
* nY1 = static_cast<int>((static_cast<Npp32f>(deviceline.rho - (nAccumulatorsHeight >> 1)) -
* ((nX1 - nCenterX) * nCosTheta)) / nSinTheta + nCenterY);
* nX2 = maximum cartesian X boundary value;
* nY2 = static_cast<int>((static_cast<Npp32f>(deviceline.rho - (nAccumulatorsHeight >> 1)) -
* ((nX2 - nCenterX) * nCosTheta)) / nSinTheta + nCenterY);
* }
* else
* {
* // x = (rho - y sin(theta)) / cos(theta)
* nY1 = minimum cartesian Y boundary value;
* nX1 = static_cast<int>((static_cast<Npp32f>(deviceline.rho - (nAccumulatorsHeight >> 1)) -
* ((nY1 - nCenterY) * nSinTheta)) / nCosTheta + nCenterX);
* nY2 = maximum cartesian Y boundary value;
* nX2 = static_cast<int>((static_cast<Npp32f>(deviceline.rho - (nAccumulatorsHeight >> 1)) -
* ((nY2 - nCenterY) * nSinTheta)) / nCosTheta + nCenterX);
* }
*

Function Documentation

NppStatus nppiFilterHoughLine_8u32f_C1R ( const Npp8u pSrc,
int  nSrcStep,
NppiSize  oSizeROI,
NppPointPolar  nDelta,
int  nThreshold,
NppPointPolar pDeviceLines,
int  nMaxLineCount,
int *  pDeviceLineCount,
Npp8u pDeviceBuffer 
)
NppStatus nppiFilterHoughLine_8u32f_C1R_Ctx ( const Npp8u pSrc,
int  nSrcStep,
NppiSize  oSizeROI,
NppPointPolar  nDelta,
int  nThreshold,
NppPointPolar pDeviceLines,
int  nMaxLineCount,
int *  pDeviceLineCount,
Npp8u pDeviceBuffer,
NppStreamContext  nppStreamCtx 
)

1 channel 8-bit unsigned binarized (0, 255) source feature (canny edges, etc.) source image to list of lines in point polar format representing the length (rho) and angle (theta) of each line from the origin of the normal to the line using the formula rho = x cos(theta) + y sin(theta).

The level of discretization, nDelta, is specified as an input parameter. The performance and effectiveness of this function highly depends on this parameter with higher performance for larger numbers and more detailed results for lower numbers. nDelta must have the same values as those used in the nppiFilterHoughLineGetBufferSize() function call.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
nDeltaDiscretization steps, range 0.0F < radial increment nDelta.rho < 3.0F, 1.0F recommended, range 0.25F < angular increment nDelta.theta < 3.0F, 1.0F recommended.
nThresholdMinimum number of points to accept a line.
pDeviceLinesDevice pointer to (nMaxLineCount * sizeof(NppPointPolar) line objects.
nMaxLineCountThe maximum number of lines to output.
pDeviceLineCountThe number of lines detected by this function up to nMaxLineCount.
pDeviceBufferpointer to scratch DEVICE memory buffer of size hpBufferSize (see nppiFilterHoughLineGetBufferSize() above)
nppStreamCtxApplication Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiFilterHoughLineGetBufferSize ( NppiSize  oSizeROI,
NppPointPolar  nDelta,
int  nMaxLineCount,
int *  hpBufferSize 
)

Calculate scratch buffer size needed for the FilterHoughLine or FilterHoughLineRegion functions based on destination image SizeROI width and height and nDelta parameters.

Parameters
oSizeROIRegion-of-Interest (ROI).
nDeltarho radial increment and theta angular increment that will be used in the FilterHoughLine or FilterHoughLineRegion function call.
nMaxLineCountThe maximum number of lines expected from the FilterHoughLine or FilterHoughLineRegion function call.
hpBufferSizeRequired buffer size in bytes. Important: hpBufferSize is a host pointer. Scratch Buffer and Host Pointer.
Returns
Image Data Related Error Codes, ROI Related Error Codes
NppStatus nppiFilterHoughLineRegion_8u32f_C1R ( const Npp8u pSrc,
int  nSrcStep,
NppiSize  oSizeROI,
NppPointPolar  nDelta,
int  nThreshold,
NppPointPolar pDeviceLines,
NppPointPolar  oDstROI[2],
int  nMaxLineCount,
int *  pDeviceLineCount,
Npp8u pDeviceBuffer 
)
NppStatus nppiFilterHoughLineRegion_8u32f_C1R_Ctx ( const Npp8u pSrc,
int  nSrcStep,
NppiSize  oSizeROI,
NppPointPolar  nDelta,
int  nThreshold,
NppPointPolar pDeviceLines,
NppPointPolar  oDstROI[2],
int  nMaxLineCount,
int *  pDeviceLineCount,
Npp8u pDeviceBuffer,
NppStreamContext  nppStreamCtx 
)

1 channel 8-bit unsigned binarized (0, 255) source feature (canny edges, etc.) source image to list of lines in point polar format representing the length (rho) and angle (theta) of each line from the origin of the normal to the line using the formula rho = x cos(theta) + y sin(theta).

The level of discretization, nDelta, is specified as an input parameter. The performance and effectiveness of this function highly depends on this parameter with higher performance for larger numbers and more detailed results for lower numbers. nDelta must have the same values as those used in the nppiFilterHoughLineGetBufferSize() function call. The oDstROI region limits are used to limit accepted lines to those that fall within those limits.

Parameters
pSrcSource-Image Pointer.
nSrcStepSource-Image Line Step.
oSizeROIRegion-of-Interest (ROI).
nDeltaDiscretization steps, range 0.0F < radial increment nDelta.rho < 3.0F, 1.0F recommended, range 0.25F < angular increment nDelta.theta < 3.0F, 1.0F recommended.
nThresholdMinimum number of points to accept a line.
pDeviceLinesDevice pointer to (nMaxLineCount * sizeof(NppPointPolar) line objects.
oDstROIRegion limits with oDstROI[0].rho <= accepted rho <= oDstROI[1].rho and oDstROI[0].theta <= accepted theta <= oDstROI[1].theta.
nMaxLineCountThe maximum number of lines to output.
pDeviceLineCountThe number of lines detected by this function up to nMaxLineCount.
pDeviceBufferpointer to scratch DEVICE memory buffer of size hpBufferSize (see nppiFilterHoughLineGetBufferSize() above)
nppStreamCtxApplication Managed Stream Context.
Returns
Image Data Related Error Codes, ROI Related Error Codes

Copyright © 2009-2021 NVIDIA CORPORATION AND AFFILIATES