All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
FilterHoughLine
Computer Vision

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

  pSrc | Source-Image Pointer.
  nSrcStep | Source-Image Line Step.
  oSizeROI | Region-of-Interest (ROI).
  nDelta | Discretization 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.
  nThreshold | Minimum number of points to accept a line.
  pDeviceLines | Device pointer to (nMaxLineCount * sizeof(NppPointPolar) line objects.
  nMaxLineCount | The maximum number of lines to output.
  pDeviceLineCount | The number of lines detected by this function up to nMaxLineCount.
  pDeviceBuffer | pointer to scratch DEVICE memory buffer of size hpBufferSize (see nppiFilterHoughLineGetBufferSize() above)
  nppStreamCtx | Application 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

  oSizeROI | Region-of-Interest (ROI).
  nDelta | rho radial increment and theta angular increment that will be used in the FilterHoughLine or FilterHoughLineRegion function call.
  nMaxLineCount | The maximum number of lines expected from the FilterHoughLine or FilterHoughLineRegion function call.
  hpBufferSize | Required 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

  pSrc | Source-Image Pointer.
  nSrcStep | Source-Image Line Step.
  oSizeROI | Region-of-Interest (ROI).
  nDelta | Discretization 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.
  nThreshold | Minimum number of points to accept a line.
  pDeviceLines | Device pointer to (nMaxLineCount * sizeof(NppPointPolar) line objects.
  oDstROI | Region limits with oDstROI[0].rho <= accepted rho <= oDstROI[1].rho and oDstROI[0].theta <= accepted theta <= oDstROI[1].theta.
  nMaxLineCount | The maximum number of lines to output.
  pDeviceLineCount | The number of lines detected by this function up to nMaxLineCount.
  pDeviceBuffer | pointer to scratch DEVICE memory buffer of size hpBufferSize (see nppiFilterHoughLineGetBufferSize() above)
  nppStreamCtx | Application Managed Stream Context.

Returns
  Image Data Related Error Codes, ROI Related Error Codes

Copyright © 2009-2019 NVIDIA Corporation