# Feature detection

- FASTCV\_API void fcvCornerFast9u8(const uint8\_t \*\_\_restrict src, unsigned int srcWidth, unsigned int srcHeight, unsigned int srcStride, int barrier, unsigned int border, uint32\_t \*\_\_restrict xy, unsigned int nCornersMax, uint32\_t \*\_\_restrict nCorners)

    - Extracts FAST corners from the image. This function tests the whole image for corners (apart from the border). FAST-9 looks for continuous segments on the pixel ring of 9 pixels or more.

- Parameters:

    - - **src** – Pointer to grayscale image with one byte per pixel **WARNING:** should be 128-bit aligned.
- **srcWidth** – Input image width **WARNING:** should be a multiple of 8. **WARNING:** must be &lt;= 2048.
- **srcHeight** – Image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2). If 0 is passed, srcStride is set to width. **WARNING:** should be a multiple of 8.
- **barrier** – FAST threshold. The threshold is used to compare difference between intensity value of the central pixel and pixels on a circle surrounding this pixel.
- **border** – Number for pixels to ignore from top,bottom,right,left of the image **WARNING:** If border &lt; 3, it will be default to 3. **WARNING:** srcWidth and srcHeight must be &gt; 2 x border
- **xy** –

    pointer to the output array containing the interleaved x,y position of the detected corners

    e.g. struct { int x, y; } xy;

**WARNING:** should be 128-bit aligned. **NOTE:** Remember to allocate double the size of
- **nCornersMax** –
- **nCornersMax** – Maximum number of corners. The function exits when the maximum number of corners is exceeded
- **nCorners** – pointer to an integer storing the number of corners detected

- FASTCV\_API void fcvCornerFast9InMasku8(const uint8\_t \*\_\_restrict src, unsigned int srcWidth, unsigned int srcHeight, unsigned int srcStride, int barrier, unsigned int border, uint32\_t \*\_\_restrict xy, unsigned int nCornersMax, uint32\_t \*\_\_restrict nCorners, const uint8\_t \*\_\_restrict mask, unsigned int maskWidth, unsigned int maskHeight)

    - Extracts FAST corners from the image. This function takes a bit mask so that only image areas masked with ‘0’ are tested for corners (if these areas are also not part of the border). FAST-9 looks for continuous segments on the pixel ring of 9 pixels or more.

- Parameters:

    - - **src** – pointer to grayscale image with one byte per pixel **WARNING:** should be 128-bit aligned.
- **srcWidth** – image width **WARNING:** must be &lt;= 2048. **WARNING:** should be a multiple of 8.
- **srcHeight** – image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2). **WARNING:** should be a multiple of 8. If left at 0 srcStride is default to srcWidth.
- **barrier** – FAST threshold. The threshold is used to compare difference between intensity value of the central pixel and pixels on a circle surrounding this pixel.
- **border** – Number for pixels to ignore from top,bottom,right,left of the image **WARNING:** If border &lt; 3, it will be default to 3. **WARNING:** srcWidth and srcHeight must be &gt; 2 x border
- **xy** – pointer to the output array containing the interleaved x,y position of the detected corners **WARNING:** should be 128-bit aligned. **NOTE:** Remember to allocate double the size of
- **nCornersMax** –
- **nCornersMax** – Maximum number of corners. The function exits when the maximum number of corners is exceeded
- **nCorners** – pointer to an integer storing the number of corners detected
- **mask** – Per-pixel mask for each pixel represented in input image. If a bit set to 0, pixel will be a candidate for corner detection. If a bit set to 1, pixel will be ignored.
- **maskWidth** – Width of the mask. Both width and height of the mask must be ‘k’ times image width and height, where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8.
- **maskHeight** – Height of the mask. Both width and height of the mask must be ‘k’ times image width and height, where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8.

- FASTCV\_API void fcvCornerFast10u8(const uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, int32\_t barrier, uint32\_t border, uint32\_t \*\_\_restrict xy, uint32\_t nCornersMax, uint32\_t \*\_\_restrict nCorners)

    - Extracts FAST corners from the image. This function tests the whole image for corners (apart from the border). FAST-10 looks for continuous segments on the pixel ring of 10 pixels or more.

- Parameters:

    - - **src** – Pointer to grayscale image with one byte per pixel **WARNING:** should be 128-bit aligned.
- **srcWidth** – Input image width **WARNING:** should be a multiple of 8. **WARNING:** must be &lt;= 2048.
- **srcHeight** – Image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2). If 0 is passed, srcStride is set to width.
- **barrier** – FAST threshold. The threshold is used to compare difference between intensity value of the central pixel and pixels on a circle surrounding this pixel.
- **border** – Number for pixels to ignore from top,bottom,right,left of the image **WARNING:** If border &lt; 3, it will be default to 3. **WARNING:** srcWidth and srcHeight must be &gt; 2 x border
- **xy** –

    pointer to the output array containing the interleaved x,y position of the detected corners

    e.g. struct { int x, y; } xy;

**WARNING:** should be 128-bit aligned. **NOTE:** Remember to allocate double the size of
- **nCornersMax** –
- **nCornersMax** – Maximum number of corners. The function exists when the maximum number of corners is exceeded
- **nCorners** – pointer to an integer storing the number of corners detected

- FASTCV\_API void fcvCornerFast10InMasku8(const uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, int32\_t barrier, uint32\_t border, uint32\_t \*\_\_restrict xy, uint32\_t nCornersMax, uint32\_t \*\_\_restrict nCorners, const uint8\_t \*\_\_restrict mask, uint32\_t maskWidth, uint32\_t maskHeight)

    - Extracts FAST corners from the image. This function takes a bit mask so that only image areas masked with ‘0’ are tested for corners (if these areas are also not part of the border). FAST-10 looks for continuous segments on the pixel ring of 10 pixels or more.

- Parameters:

    - - **src** – pointer to grayscale image with one byte per pixel **WARNING:** should be 128-bit aligned.
- **srcWidth** – image width **WARNING:** must be &lt;= 2048. **WARNING:** should be a multiple of 8.
- **srcHeight** – image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2).
- **barrier** – FAST threshold. The threshold is used to compare difference between intensity value of the central pixel and pixels on a circle surrounding this pixel.
- **border** – Number for pixels to ignore from top,bottom,right,left of the image **WARNING:** If border &lt; 3, it will be default to 3. **WARNING:** srcWidth and srcHeight must be &gt; 2 x border
- **xy** – pointer to the output array containing the interleaved x,y position of the detected corners **WARNING:** should be 128-bit aligned. **NOTE:** Remember to allocate double the size of
- **nCornersMax** –
- **nCornersMax** – Maximum number of corners. The function exists when the maximum number of corners is exceeded
- **nCorners** – pointer to an integer storing the number of corners detected
- **mask** – Per-pixel mask for each pixel represented in input image. If a bit set to 0, pixel will be a candidate for corner detection. If a bit set to 1, pixel will be ignored.
- **maskWidth** – Width of the mask. Both width and height of the mask must be ‘k’ times image width and height, where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8.
- **maskHeight** – Height of the mask. Both width and height of the mask must be ‘k’ times image width and height, where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8.

- FASTCV\_API void fcvCornerHarrisu8(const uint8\_t \*\_\_restrict src, unsigned int srcWidth, unsigned int srcHeight, unsigned int srcStride, unsigned int border, uint32\_t \*\_\_restrict xy, unsigned int nCornersMax, uint32\_t \*\_\_restrict nCorners, int threshold)

    - Extracts Harris corners from the image. This function tests the whole image for corners (apart from the border).

- Parameters:

    - - **src** – Pointer to grayscale image with one byte per pixel **WARNING:** should be 128-bit aligned.
- **srcWidth** – Input image width **WARNING:** should be a multiple of 8.
- **srcHeight** – Image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2).
- **border** – Number for pixels to ignore from top,bottom,right,left of the image
- **xy** – pointer to the output array containing the interleaved x,y position of the detected corners **WARNING:** should be 128-bit aligned. **NOTE:** Remember to allocate double the size of
- **nCornersMax** –
- **nCornersMax** – Maximum number of corners. The function exits when the maximum number of corners is exceeded
- **nCorners** – pointer to an integer storing the number of corners detected
- **threshold** – Minimum “Harris Score” or “Harris Corner Response” of a pixel for it to be regarded as a corner.

- Returns:

    - 0 if successful.

- FASTCV\_API unsigned int fcvLocalHarrisMaxu8(const uint8\_t \*\_\_restrict src, unsigned int srcWidth, unsigned int srcHeight, unsigned int srcStride, unsigned int posX, unsigned int posY, unsigned int \*maxX, unsigned int \*maxY, int \*maxScore)

    - Local Harris Max applies the Harris Corner algorithm on an 11x11 patch within an image to determine if a corner is present.

- Parameters:

    - - **src** – Pointer to grayscale image with one byte per pixel **WARNING:** should be 128-bit aligned.
- **srcWidth** – Input image width **WARNING:** should be a multiple of 8.
- **srcHeight** – Image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2). If srcStride == 0, then will use srcWidth.
- **posX** – Center X coordinate of the search window
- **posY** – Center Y coordinate of the search window
- **maxX** – pointer to the X coordinate identified as a corner
- **maxY** – pointer to the Y coordinate identified as a corner
- **maxScore** – pointer to the Harris score associated with the corner

- Returns:

    - 0 if no corner is found (maxX, maxY, and maxScore are invalid) or if posX and/or posY position the patch outside of the range of the source image. 1 if a corner is found (maxX, maxY, and maxScore are valid)

- FASTCV\_API void fcvCornerHarrisInMasku8(const uint8\_t \*\_\_restrict src, unsigned int srcWidth, unsigned int srcHeight, unsigned int srcStride, unsigned int border, uint32\_t \*\_\_restrict xy, unsigned int nCornersMax, uint32\_t \*\_\_restrict nCorners, int threshold, const uint8\_t \*\_\_restrict mask, unsigned int maskWidth, unsigned int maskHeight)

    - Extracts Harris corners from the image. This function takes a bit mask so that only image areas masked with ‘0’ are tested for corners (if these areas are also not part of the border).

- Parameters:

    - - **src** – pointer to grayscale image with one byte per pixel **WARNING:** should be 128-bit aligned.
- **srcWidth** – image width **WARNING:** should be a multiple of 8.
- **srcHeight** – image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2).
- **border** – Number for pixels to ignore from top,bottom,right,left of the image
- **xy** – pointer to the output array containing the interleaved x,y position of the detected corners **WARNING:** should be 128-bit aligned.
- **nCornersMax** – Maximum number of corners. The function exits when the maximum number of corners is exceeded
- **nCorners** – pointer to an integer storing the number of corners detected
- **threshold** – Minimum “Harris Score” or “Harris Corner Respose” of a pixel for it to be regarded as a corner.
- **mask** – Per-pixel mask for each pixel represented in input image. If a bit set to 0, pixel will be a candidate for corner detection. If a bit set to 1, pixel will be ignored.
- **maskWidth** – Width of the mask. Both width and height of the mask must be ‘k’ times image width and height, where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8.
- **maskHeight** – Height of the mask. Both width and height of the mask must be ‘k’ times image width and height, where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8.

- Returns:

    - 0 if successful.

- FASTCV\_API void fcvCornerHarrisAdaptiveu8(const uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, uint32\_t border, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict xy, uint32\_t nCornersMax, uint32\_t \*\_\_restrict nCorners, int32\_t threshold)

    - Extracts Harris corners from the image. This function tests the whole image for corners (apart from the border). It is an improved version which is more robust to low contrast images.

- Parameters:

    - - **src** – Pointer to grayscale image with one byte per pixel **WARNING:** should be 128-bit aligned.
- **srcWidth** – Input image width
- **srcHeight** – Image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2). **WARNING:** should be a multiple of 8.
- **border** – Number for pixels to ignore from top,bottom,right,left of the image
- **xy** – pointer to the output array containing the interleaved x,y position of the detected corners **WARNING:** should be 128-bit aligned. **NOTE:** Remember to allocate double the size of
- **nCornersMax** –
- **nCornersMax** – Maximum number of corners. The function exits when the maximum number of corners is exceeded
- **nCorners** – pointer to an integer storing the number of corners detected
- **threshold** – Minimum “Harris Score” or “Harris Corner Response” of a pixel for it to be regarded as a corner.

- FASTCV\_API [fcvStatus](https://docs.qualcomm.com/doc/80-79511-2/topic/enum_a00021_1a39574810b4ad6914ee8613424f316283.html#_CPPv49fcvStatus) fcvCornerHarrisScoreu8(const uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict harrisResp, uint32\_t respStride, uint32\_t \*\_\_restrict xy, uint32\_t nCornersMax, uint32\_t \*\_\_restrict nCorners, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) threshold, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) sensitivity, uint32\_t kernelSize, uint32\_t blockSize, uint32\_t nmsEnabled, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) minDistance, uint32\_t normalizeResponse)

    - Extracts Harris corners from the image. **ATTENTION:**

Compared to fcvCornerHarrisu8, this API gives more accurate results in exchange for slower execution time.

.

DO NOT USE THIS API unless for testing purposes. This API can be removed without notice.

This function extracts Harris Corner features from the image. The input is an unsigned 8 bit image. Based on the values of the kernel size, the block size, the sensitivity, the function generates a Harris Response map (Harris Score). This map is then thresholded using the threshold parameter to locate local maxima. Additionally, if the Non Maximum Suppression flag is enabled, the function performs non maximum suppression of the thresholded response using the min distance parameter to calculate the neighborhood.

- Parameters:

    - - **src** – Input unsigned 8 bit image from which corner features are to be detected **WARNING:** should be 128-bit aligned.
- **srcWidth** – Input image width
- **srcHeight** – Input Image height
- **srcStride** – Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row. If srcStride is equal to 0, it will be set to srcWidth. **NOTE:** should be a multiple of 8
- **harrisResp** – The computed Harris Response Map of the image. If the
- **normalizeResponse** – flag is set, then all values in the map are normalized between 0 and 255. If the
- **normalizeResponse** – flag is not set, then the map is not normalized to this range. This buffer MUST be allocated as srcWidth\*srcHeight\*sizeof(float32\_t).
- **respStride** – Harris response stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row. If respStride is equal to 0, it will be set to srcWidth \* sizeof(float32\_t). **NOTE:** should be a multiple of 8
- **xy** – pointer to the output array containing the interleaved x,y positions of the detected corners. **WARNING:** should be 128-bit aligned. **NOTE:** Remember to allocate double the size of
- **nCornersMax** –
- **nCornersMax** – Maximum number of corners that should be detected. The function exits when the maximum number of corners is exceeded. **NOTE:** This number should account for the number of key points before non-maximum suppression.
- **nCorners** – pointer to an integer storing the number of corners detected
- **threshold** – Minimum “Harris Score” or “Harris Corner Response” of a pixel for it to be regarded as a corner. If the
- **normalizeResponse** – flag is set, then this parameter MUST be a value between 0 and 255. If the
- **normalizeResponse** – flag is not set, then this parameter can be any value in the range of int32\_t. This parameter is used to threshold
- **harrisResp** – to detect corner features.
- **sensitivity** – This parameter represents the sensitivity threshold from the Harris Stephens equation. Typical values are between 0.04 and 0.06
- **kernelSize** – Size of the Sobel Kernel used to compute the gradients from the input image MUST be 3,5 or 7.
- **blockSize** – Size of an average block for computing a derivative covariation matrix over each pixel neighborhood.
- **nmsEnabled** – A flag to enable or disable non maximum suppression. Set flag to 1 to enable it and 0 to disable. **NOTE:** When NMS is enabled, be sure to assign large enough nCornersMax to store raw key points before NMS
- **minDistance** – The radial euclidean distance to perform non-maximum suppression.
- **normalizeResponse** – This parameter is a flag to enable or disable normalization of the harris response. If it is set, then it enables normalization of the response to the range between 0 and 255. If it is not set, then the response is NOT normalized to this range.

- Returns:

    - FASTCV\_SUCCESS upon success. Other status codes upon failure.

- FASTCV\_API void fcvCornerFast9Scoreu8(const uint8\_t \*\_\_restrict src, unsigned int srcWidth, unsigned int srcHeight, unsigned int srcStride, int barrier, unsigned int border, uint32\_t \*\_\_restrict xy, uint32\_t \*\_\_restrict scores, unsigned int nCornersMax, uint32\_t \*\_\_restrict nCorners)

    - Extracts FAST corners and scores from the image.

- Parameters:

    - - **src** – 8-bit image **NOTE:** should be 128-bit aligned.
- **srcWidth** – Image width **NOTE:** should be a multiple of 8. **WARNING:** must be &lt;= 2048.
- **srcHeight** – image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2).
- **barrier** – FAST threshold. The threshold is used to compare difference between intensity value of the central pixel and pixels on a circle surrounding this pixel.
- **border** – Number for pixels to ignore from top,bottom,right,left of the image **WARNING:** If border &lt; 3, it will be default to 3. **WARNING:** srcWidth and srcHeight must be &gt; 2 x border
- **xy** – pointer to the output array cointaining the interleaved x,y position of the detected corners. **NOTE:** Remember to allocate double the size of
- **nCornersMax** – **NOTE:** should be 128-bit aligned.
- **scores** – Pointer to the output array containing the scores of the detected corners. The score is the highest threshold that can still validate the detected corner. Must be greater than barrier. A higher score value indicates a stronger corner feature. For example, a corner of score 108 is stronger than a corner of score 50. **NOTE:** should be 128-bit aligned.
- **nCornersMax** – Maximum number of corners. The function exits when the maximum number of corners is exceeded.
- **nCorners** – pointer to an integer storing the number of corners detected

- FASTCV\_API void fcvCornerFast9InMaskScoreu8(const uint8\_t \*\_\_restrict src, unsigned int srcWidth, unsigned int srcHeight, unsigned int srcStride, int barrier, unsigned int border, uint32\_t \*\_\_restrict xy, uint32\_t \*\_\_restrict scores, unsigned int nCornersMax, uint32\_t \*\_\_restrict nCorners, const uint8\_t \*\_\_restrict mask, unsigned int maskWidth, unsigned int maskHeight)

    - Extracts FAST corners and scores from the image.

- Parameters:

    - - **src** – Grayscale image with one byte per pixel **NOTE:** should be 128-bit aligned.
- **srcWidth** – image width **NOTE:** should be a multiple of 8. **WARNING:** must be &lt;= 2048.
- **srcHeight** – image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2).
- **barrier** – FAST threshold. The threshold is used to compare difference between intensity value of the central pixel and pixels on a circle surrounding this pixel.
- **border** – Number for pixels to ignore from top,bottom,right,left of the image **WARNING:** If border &lt; 3, it will be default to 3. **WARNING:** srcWidth and srcHeight must be &gt; 2 x border
- **xy** – Pointer to the output array cointaining the interleaved x,y position of the detected corners. **NOTE:** Remember to allocate double the size of
- **nCornersMax** – **NOTE:** should be 128-bit aligned.
- **scores** – Pointer to the output array containing the scores of the detected corners. The score is the highest threshold that can still validate the detected corner. Must be greater than barrier. A higher score value indicates a stronger corner feature. For example, a corner of score 108 is stronger than a corner of score 50. **NOTE:** should be 128-bit aligned.
- **nCornersMax** – Maximum number of corners. The function exits when the maximum number of corners is exceeded.
- **nCorners** – pointer to an integer storing the number of corners detected
- **mask** – Per-pixel mask for each pixel represented in input image. If a bit set to 0, pixel will be a candidate for corner detection. If a bit set to 1, pixel will be ignored.
- **maskWidth** – Width of the mask. Both width and height of the mask must be ‘k’ times image width and height, where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8.
- **maskHeight** – Height of the mask. Both width and height of the mask must be ‘k’ times image width and height, where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8.

- FASTCV\_API void fcvCornerFast9Scoreu8\_v2(const uint8\_t \*\_\_restrict src, unsigned int srcWidth, unsigned int srcHeight, unsigned int srcStride, int barrier, unsigned int border, uint32\_t \*\_\_restrict xy, uint32\_t \*\_\_restrict scores, unsigned int nCornersMax, uint32\_t \*\_\_restrict nCorners, uint32\_t nmsEnabled, void \*\_\_restrict tempBuf)

    - Extracts FAST corners and scores from the image.

**ATTENTION:** This function is a duplication of [fcvCornerFast9Scoreu8()](https://docs.qualcomm.com/doc/80-79511-2/topic/feature_detection.html#a00025_1ga620c775ded5ed47a741f7333decde631) with the addition of extra parameters. This function has been added to allow for backward compatibility with the original function. When the 2.0.0 release of this library is made, this function will be renamed to: *fcvCornerFast9Scoreu8*, *fcvCornerFast9Scoreu8\_v2* will be removed, and the current signature for *fcvCornerFast9Scoreu8* will be removed. Until 2.0.0, the developer should use this implementation with the expectation of renaming it to *fcvCornerFast9Scoreu8* when transitioning to 2.0.0.

non-maximum suppression can be enabled to reduce the number of false corners.

- Parameters:

    - - **src** – 8-bit image where keypoints are detected. Size of buffer is srcStride\*srcHeight bytes. **NOTE:** should be 128-bit aligned.
- **srcWidth** – Image width, the number of pixels in a row. **NOTE:** should be a multiple of 8.
- **srcHeight** – Image height
- **srcStride** – Stride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. **NOTE:** should be a multiple of 8.
- **barrier** – FAST threshold. The threshold is used to compare difference between intensity value of the central pixel and pixels on a circle surrounding this pixel.
- **border** – Number for pixels to ignore from top,bottom,right,left of the image **WARNING:** If border &lt; 3, it will be default to 3. **WARNING:** srcWidth and srcHeight must be &gt; 2 x border
- **xy** – Pointer to the output array cointaining the interleaved x,y position of the detected corners. **NOTE:** Remember to allocate double the size of
- **nCornersMax** – **NOTE:** should be 128-bit aligned.
- **scores** – Pointer to the output array containing the scores of the detected corners. The score is the highest threshold that can still validate the detected corner. Must be greater than barrier. A higher score value indicates a stronger corner feature. For example, a corner of score 108 is stronger than a corner of score 50. **NOTE:** should be 128-bit aligned. **NOTE:** size of buffer is
- **nCornersMax** –
- **nCornersMax** – Maximum number of corners. The function exits when the maximum number of corners is exceeded. **NOTE:** This number should account for the number of key points before non-maximum suppression.
- **nCorners** – Pointer to an integer storing the number of corners detected
- **nmsEnabled** – Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) **NOTE:** When NMS is enabled, be sure to assign large enough nCornersMax to store raw key points before NMS
- **tempBuf** – Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. Size of buffer: (3\*nCornersMax+srcHeight+1)\*4 bytes **NOTE:** should be 128-bit aligned.

- FASTCV\_API void fcvCornerFast9InMaskScoreu8\_v2(const uint8\_t \*\_\_restrict src, unsigned int srcWidth, unsigned int srcHeight, unsigned int srcStride, int barrier, unsigned int border, uint32\_t \*\_\_restrict xy, uint32\_t \*\_\_restrict scores, unsigned int nCornersMax, uint32\_t \*\_\_restrict nCorners, const uint8\_t \*\_\_restrict mask, unsigned int maskWidth, unsigned int maskHeight, uint32\_t nmsEnabled, void \*\_\_restrict tempBuf)

    - Extracts FAST corners and scores from the image based on the mask. The mask specifies pixels to be ignored by the detector.

**ATTENTION:** This function is a duplication of [fcvCornerFast9InMaskScoreu8()](https://docs.qualcomm.com/doc/80-79511-2/topic/feature_detection.html#a00025_1ga1aa689c12ad05c1572077dee048cd2e3) with the addition of extra parameters. This function has been added to allow for backward compatibility with the original function. When the 2.0.0 release of this library is made, this function will be renamed to: *fcvCornerFast9InMaskScoreu8*, *fcvCornerFast9InMaskScoreu8\_v2* will be removed, and the current signature for *fcvCornerFast9InMaskScoreu8* will be removed. Until 2.0.0, the developer should use this implementation with the expectation of renaming it to *fcvCornerFast9InMaskScoreu8* when transitioning to 2.0.0.

non-maximum suppression can be enabled to reduce the number of false corners.

- Parameters:

    - - **src** – 8-bit grayscale image where keypoints are detected. Size of buffer is srcStride\*srcHeight bytes. **NOTE:** should be 128-bit aligned.
- **srcWidth** – Image width, the number of pixels in a row. **NOTE:** should be a multiple of 8.
- **srcHeight** – Image height
- **srcStride** – Stride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. **NOTE:** should be a multiple of 8.
- **barrier** – FAST threshold. The threshold is used to compare difference between intensity value of the central pixel and pixels on a circle surrounding this pixel.
- **border** – Number for pixels to ignore from top,bottom,right,left of the image **WARNING:** If border &lt; 3, it will be default to 3. **WARNING:** srcWidth and srcHeight must be &gt; 2 x border
- **xy** – Pointer to the output array cointaining the interleaved x,y position of the detected corners. **NOTE:** Remember to allocate double the size of
- **nCornersMax** – **NOTE:** should be 128-bit aligned.
- **scores** – Pointer to the output array containing the scores of the detected corners. The score is the highest threshold that can still validate the detected corner. Must be greater than barrier. A higher score value indicates a stronger corner feature. For example, a corner of score 108 is stronger than a corner of score 50. **NOTE:** should be 128-bit aligned. **NOTE:** size of buffer is
- **nCornersMax** –
- **nCornersMax** – Maximum number of corners. The function exits when the maximum number of corners is exceeded. **NOTE:** This number should account for the number of key points before non-maximum suppression.
- **nCorners** – Pointer to an integer storing the number of corners detected
- **mask** – Mask used to omit regions of the image. For allowed mask sizes refer to
- **maskWidth** – and
- **maskHeight** – . The mask is so defined to work with multiple scales if necessary. For any pixel set to ‘1’ in the mask, the corresponding pixel in the image will be ignored. **NOTE:** should be 128-bit aligned.
- **maskWidth** – Width of the mask. Both width and height of the mask must be ‘k’ times image width and height, where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8.
- **maskHeight** – Height of the mask. Both width and height of the mask must be ‘k’ times image width and height, where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8.
- **nmsEnabled** – Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) **NOTE:** When NMS is enabled, be sure to assign large enough nCornersMax to store raw key points before NMS
- **tempBuf** – Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. Size of buffer: (3\*nCornersMax+srcHeight+1)\*4 bytes **NOTE:** should be 128-bit aligned.

- FASTCV\_API void fcvCornerFast10Scoreu8(const uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, int32\_t barrier, uint32\_t border, uint32\_t \*\_\_restrict xy, uint32\_t \*\_\_restrict scores, uint32\_t nCornersMax, uint32\_t \*\_\_restrict nCorners, uint32\_t nmsEnabled, void \*\_\_restrict tempBuf)

    - Extracts FAST corners and scores from the image.

non-maximum suppression can be enabled to reduce the number of false corners.

- Parameters:

    - - **src** – 8-bit image where keypoints are detected. Size of buffer is srcStride\*srcHeight bytes. **NOTE:** should be 128-bit aligned.
- **srcWidth** – Image width, the number of pixels in a row. **NOTE:** should be a multiple of 8.
- **srcHeight** – Image height
- **srcStride** – Stride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. **NOTE:** should be a multiple of 8.
- **barrier** – FAST threshold. The threshold is used to compare difference between intensity value of the central pixel and pixels on a circle surrounding this pixel.
- **border** – Number for pixels to ignore from top,bottom,right,left of the image **WARNING:** If border &lt; 3, it will be default to 3. **WARNING:** srcWidth and srcHeight must be &gt; 2 x border
- **xy** – Pointer to the output array cointaining the interleaved x,y position of the detected corners. **NOTE:** Remember to allocate double the size of
- **nCornersMax** – **NOTE:** should be 128-bit aligned.
- **scores** – Pointer to the output array containing the scores of the detected corners. The score is the highest threshold that can still validate the detected corner. Must be greater than barrier. A higher score value indicates a stronger corner feature. For example, a corner of score 108 is stronger than a corner of score 50. **NOTE:** should be 128-bit aligned. **NOTE:** size of buffer is
- **nCornersMax** –
- **nCornersMax** – Maximum number of corners. The function exits when the maximum number of corners is exceeded. **NOTE:** This number should account for the number of key points before non-maximum suppression.
- **nCorners** – pointer to an integer storing the number of corners detected
- **nmsEnabled** – Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) **NOTE:** When NMS is enabled, be sure to assign large enough nCornersMax to store raw key points before NMS
- **tempBuf** – Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. Size of buffer: (3\*nCornersMax+srcHeight+1)\*4 bytes **NOTE:** should be 128-bit aligned.

- FASTCV\_API void fcvCornerFast10InMaskScoreu8(const uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, int32\_t barrier, uint32\_t border, uint32\_t \*\_\_restrict xy, uint32\_t \*\_\_restrict scores, uint32\_t nCornersMax, uint32\_t \*\_\_restrict nCorners, const uint8\_t \*\_\_restrict mask, uint32\_t maskWidth, uint32\_t maskHeight, uint32\_t nmsEnabled, void \*\_\_restrict tempBuf)

    - Extracts FAST corners and scores from the image based on the mask. The mask specifies pixels to be ignored by the detector.

- Parameters:

    - - **src** – 8-bit grayscale image where keypoints are detected **NOTE:** data should be 128-bit aligned.
- **srcWidth** – image width **NOTE:** should be a multiple of 8.
- **srcHeight** – Image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2). **NOTE:** should be a multiple of 8.
- **barrier** – FAST threshold. The threshold is used to compare difference between intensity value of the central pixel and pixels on a circle surrounding this pixel.
- **border** – Number for pixels to ignore from top,bottom,right,left of the image **WARNING:** If border &lt; 3, it will be default to 3. **WARNING:** srcWidth and srcHeight must be &gt; 2 x border
- **xy** – Pointer to the output array cointaining the interleaved x,y position of the detected corners. **NOTE:** Remember to allocate double the size of nCornersMax **NOTE:** data should be 128-bit aligned.
- **scores** – Pointer to the output array containing the scores of the detected corners. The score is the highest threshold that can still validate the detected corner. Must be greater than barrier. A higher score value indicates a stronger corner feature. For example, a corner of score 108 is stronger than a corner of score 50. **NOTE:** data should be 128-bit aligned.
- **nCornersMax** – Maximum number of corners. The function exits when the maximum number of corners is exceeded. **NOTE:** This number should account for the number of key points before non-maximum suppression.
- **nCorners** – pointer to an integer storing the number of corners detected
- **mask** – Mask used to omit regions of the image. For allowed mask sizes refer to maskWidth and maskHeight. The mask is so defined to work with multiple scales if necessary. For any pixel set to ‘1’ in the mask, the corresponding pixel in the image will be ignored. **NOTE:** data should be 128-bit aligned.
- **maskWidth** – Width of the mask. Both width and height of the mask must be ‘k’ times image width and height, where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8.
- **maskHeight** – Height of the mask. Both width and height of the mask must be ‘k’ times image width and height, where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8.
- **nmsEnabled** – Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) **NOTE:** When NMS is enabled, be sure to assign large enough nCornersMax to store raw key points before NMS
- **tempBuf** – Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. Size of buffer: (3\*nCornersMax+srcHeight+1)\*4 bytes **NOTE:** data should be 128-bit aligned.

- FASTCV\_API void fcvBoundingRectangle(const uint32\_t \*\_\_restrict xy, uint32\_t numPoints, uint32\_t \*rectTopLeftX, uint32\_t \*rectTopLeftY, uint32\_t \*rectWidth, uint32\_t \*rectHeight)

    - Function to find the bounding rectangle of a set of points.

- Parameters:

    - - **xy** – **[in]** Set of points (x,y) for which the bounding rectangle has to be found. The points are expressed in interleaved format: [x1,y1,x2,y2….]
- **numPoints** – **[in]** Number of points in the array.
- **rectTopLeftX** – **[out]** Lower left’s X value for the rectangle.
- **rectTopLeftY** – **[out]** Lower Left’s Y value for the rectangle;
- **rectWidth** – **[out]** Width of the rectangle.
- **rectHeight** – **[out]** Height of the rectangle.

- FASTCV\_API uint32\_t fcvKMeansTreeSearch36x10s8(const int8\_t \*\_\_restrict nodeChildrenCenter, const uint32\_t \*\_\_restrict nodeChildrenInvLenQ32, const uint32\_t \*\_\_restrict nodeChildrenIndex, const uint8\_t \*\_\_restrict nodeNumChildren, uint32\_t numNodes, const int8\_t \*\_\_restrict key)

    - Search K-Means tree, where each node connects to up to 10 children, and the center (mean) is a 36-tuple vector of 8-bit signed value.

- Parameters:

    - - **nodeChildrenCenter** – A pointer to uint8\_t [numNodes][10][36], which stores the center vectors of node children. The outer-most dimension represents the nodes in the tree. The middle dimension represents the children of each node. The inner-most dimension represents the tuples of the center vector. **WARNING:** must be 64-bit aligned.
- **nodeChildrenInvLenQ32** – A pointer to uint32\_t [numNodes][10], which stores the inverse lengths of the center vectors. The inverse lengths are in Q32 format. The outer-most dimension represents the nodes in the tree. The inner-most dimension represents the children of each node. **WARNING:** must be 64-bit aligned.
- **nodeChildrenIndex** – A pointer to uint32\_t [numNodes][10], which stores the indices of the children nodes. If the MSB is 0, the index points to a node within the tree. If the MSB is 1, the index (with MSB removed) points to a leaf node, which is returned by this function as the search result. See nodeChildrenInvLenQ32 for the definition of each dimension. **WARNING:** must be 64-bit aligned.
- **nodeNumChildren** – A pointer to uint8\_t [numNodes], which stores the number of children in each node.
- **numNodes** – Number of nodes in the K-Means tree.
- **key** – A pointer to int8\_t [36], which stores the key to be searched.

- Returns:

    - Index of the leaf node.

- FASTCV\_API int fcvLinearSearchPrepare8x36s8(uint32\_t \*\_\_restrict dbLUT, uint32\_t numDBLUT, int8\_t \*\_\_restrict descDB, uint32\_t \*\_\_restrict descDBInvLenQ38, uint16\_t \*\_\_restrict descDBTargetId, uint32\_t \*\_\_restrict descDBOldIdx, uint32\_t numDescDB)

    - Sorts in-place the pairs of &lt;descDB, descDBInvLenQ38 &gt; according to descDBTargetId.

- Parameters:

    - - **dbLUT** – A pointer to uint32\_t [numDBLUT][2], which stores the starting index of descDB and the number of descriptors **WARNING:** must be 64-bit aligned.
- **numDBLUT** – The size of dbLUT
- **descDB** – A pointer to int8\_t [numDescDB][36], which stores descriptors **WARNING:** must be 64-bit aligned.
- **descDBInvLenQ38** – A pointer to uint32\_t [numDescDB], which stores the inverse length of descDB. The value is in Q38 format.
- **descDBTargetId** – A pointer to uint16\_t [numDescDB], which stores the target id.
- **descDBOldIdx** – A pointer to uint32\_t [numDescDB], which stores the old index of the desc before sorting
- **numDescDB** – Number of descriptor in the database.

- FASTCV\_API void fcvLinearSearch8x36s8(const uint32\_t \*\_\_restrict dbLUT, uint32\_t numDBLUT, const int8\_t \*\_\_restrict descDB, const uint32\_t \*\_\_restrict descDBInvLenQ38, const uint16\_t \*\_\_restrict descDBTargetId, uint32\_t numDescDB, const int8\_t \*\_\_restrict srcDesc, const uint32\_t \*\_\_restrict srcDescInvLenQ38, const uint32\_t \*\_\_restrict srcDescIdx, uint32\_t numSrcDesc, const uint16\_t \*\_\_restrict targetsToIgnore, uint32\_t numTargetsToIgnore, uint32\_t maxDistanceQ31, uint32\_t \*\_\_restrict correspondenceDBIdx, uint32\_t \*\_\_restrict correspondenceSrcDescIdx, uint32\_t \*\_\_restrict correspondenceDistanceQ31, uint32\_t maxNumCorrespondences, uint32\_t \*\_\_restrict numCorrespondences)

    - Perform linear search of descriptor in a database.

- Parameters:

    - - **dbLUT** – A pointer to uint32\_t [numDBLUT][2], which stores the starting index of descDB and the number of descriptors **WARNING:** must be 64-bit aligned.
- **numDBLUT** – The size of dbLUT
- **descDB** – A pointer to int8\_t [numDescDB][36], which stores descriptors **WARNING:** must be 64-bit aligned.
- **descDBInvLenQ38** – A pointer to uint32\_t [numDescDB], which stores the inverse length of descDB. The value is in Q38 format.
- **descDBTargetId** – A pointer to uint16\_t [numDescDB], which stores the target id.
- **numDescDB** – Number of descriptor in the database.
- **srcDesc** – A pointer to int8\_t [numSrcDesc][36], which stores descriptors. **WARNING:** must be 64-bit aligned.
- **srcDescInvLenQ38** – A pointer to uint32\_t [numSrcDec], which stores the inverse length of srcDesc. The value is in Q38 format.
- **srcDescIdx** – A pointer to the dbLUT data
- **numSrcDesc** – Number of source descriptor
- **targetsToIgnore** – A list of target IDs to be ignored
- **numTargetsToIgnore** – Number of targets to be ignored
- **maxDistanceQ31** – Maximum distance for correspondences. In Q31 format.
- **correspondenceDBIdx** – A pointer to uint32\_t [maxNumCorrespondences], which will be used by this function to output indices of featuresDB as a part of correspondences.
- **correspondenceSrcDescIdx** – A pointer to uint32\_t [maxNumCorrespondences], which will be used by this function to output indices of descriptors as a part of correspondences.
- **correspondenceDistanceQ31** – A pointer to uint32\_t [maxNumCorrespondences], which will be used by this function to output the distances as a part of correspondences. In Q31 format.
- **maxNumCorrespondences** – Maximum number of correspondences allowed
- **numCorrespondences** – Number of correspondences returned by this function

- FASTCV\_API void fcvFindContoursExternalu8(uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, uint32\_t maxNumContours, uint32\_t \*\_\_restrict numContours, uint32\_t \*\_\_restrict numContourPoints, uint32\_t \*\*\_\_restrict contourStartPoints, uint32\_t \*\_\_restrict pointBuffer, uint32\_t pointBufferSize, int32\_t hierarchy, void \*contourHandle)

    - Finds only extreme outer contours in a binary image. There is no nesting relationship between contours. It sets hierarchy[i][2]=hierarchy[i][3]=-1 for all the contours.

- Parameters:

    - - **src** – Grayscale image with one byte per pixel. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary.
- **srcWidth** – Image width
- **srcHeight** – Image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2).
- **maxNumContours** – Maximum number of contours can be found
- **numContours** – Number of actually found contours
- **numContourPoints** – Number of points in each found contour
- **contourStartPoints** – Pointers to the start point of each found contour
- **pointBuffer** – Pointer to point buffer for contour points’ coordinates. It should be allocated before calling this function.
- **pointBufferSize** – Size of point buffer in terms of uint32\_t
- **hierarchy** – Information about the image topology. It has numContours elements. For each contour i, the elements hierarchy[i][0], hiearchy[i][1], hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the next and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. If for a contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.
- **contourHandle** – Pointer to assistant and intermediate data. It should be allocated by [fcvFindContoursAllocate()](https://docs.qualcomm.com/doc/80-79511-2/topic/feature_detection.html#a00025_1gaf1f5253f202a848d565982812910c520) and deallocated by [fcvFindContoursDelete()](https://docs.qualcomm.com/doc/80-79511-2/topic/feature_detection.html#a00025_1gacde6ac35845a82848fddc2eac807906a).

- FASTCV\_API void fcvFindContoursListu8(uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, uint32\_t maxNumContours, uint32\_t \*\_\_restrict numContours, uint32\_t \*\_\_restrict numContourPoints, uint32\_t \*\*\_\_restrict contourStartPoints, uint32\_t \*\_\_restrict pointBuffer, uint32\_t pointBufferSize, void \*contourHandle)

    - Finds contours in a binary image without any hierarchical relationships.

- Parameters:

    - - **src** – Grayscale image with one byte per pixel. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary.
- **srcWidth** – Image width
- **srcHeight** – Image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2).
- **maxNumContours** – Maximum number of contours can be found
- **numContours** – Number of actually found contours
- **numContourPoints** – Number of points in each found contour
- **contourStartPoints** – Pointers to the start point of each found contour
- **pointBuffer** – Pointer to point buffer for contour points’ coordinates. It should be allocated before calling this function.
- **pointBufferSize** – Size of point buffer in terms of uint32\_t
- **contourHandle** – Pointer to assistant and intermediate data. It should be allocated by [fcvFindContoursAllocate()](https://docs.qualcomm.com/doc/80-79511-2/topic/feature_detection.html#a00025_1gaf1f5253f202a848d565982812910c520) and deallocated by [fcvFindContoursDelete()](https://docs.qualcomm.com/doc/80-79511-2/topic/feature_detection.html#a00025_1gacde6ac35845a82848fddc2eac807906a).

- FASTCV\_API void fcvFindContoursCcompu8(uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, uint32\_t maxNumContours, uint32\_t \*\_\_restrict numContours, uint32\_t \*\_\_restrict holeFlag, uint32\_t \*\_\_restrict numContourPoints, uint32\_t \*\*\_\_restrict contourStartPoints, uint32\_t \*\_\_restrict pointBuffer, uint32\_t pointBufferSize, int32\_t hierarchy, void \*contourHandle)

    - Finds contours in a binary image and organizes them into a two-level hierarchy. At the top level, there are external boundaries of the components. At the second level, there are boundaries of the holes. If there is another contour inside a hole of a connected component, it is still put at the top level.

- Parameters:

    - - **src** – Grayscale image with one byte per pixel. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary.
- **srcWidth** – Image width
- **srcHeight** – Image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2).
- **maxNumContours** – Maximum number of contours can be found (&lt;= 126)
- **numContours** – Number of actually found contours
- **holeFlag** – Hole flag for each found contour to indicate whether it is a hole or not
- **numContourPoints** – Number of points in each found contour
- **contourStartPoints** – Pointers to the start point of each found contour
- **pointBuffer** – Pointer to point buffer for contour points’ coordinates. It should be allocated before calling this function.
- **pointBufferSize** – Size of point buffer in terms of uint32\_t
- **hierarchy** – Information about the image topology. It has numContours elements. For each contour i, the elements hierarchy[i][0], hiearchy[i][1], hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the next and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. If for a contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.
- **contourHandle** – Pointer to assistant and intermediate data. It should be allocated by [fcvFindContoursAllocate()](https://docs.qualcomm.com/doc/80-79511-2/topic/feature_detection.html#a00025_1gaf1f5253f202a848d565982812910c520) and deallocated by [fcvFindContoursDelete()](https://docs.qualcomm.com/doc/80-79511-2/topic/feature_detection.html#a00025_1gacde6ac35845a82848fddc2eac807906a).

- FASTCV\_API void fcvFindContoursTreeu8(uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, uint32\_t maxNumContours, uint32\_t \*\_\_restrict numContours, uint32\_t \*\_\_restrict holeFlag, uint32\_t \*\_\_restrict numContourPoints, uint32\_t \*\*\_\_restrict contourStartPoints, uint32\_t \*\_\_restrict pointBuffer, uint32\_t pointBufferSize, int32\_t hierarchy, void \*contourHandle)

    - Finds contours in a binary image and reconstructs a full hierarchy of nested contours.

- Parameters:

    - - **src** – Grayscale image with one byte per pixel. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary.
- **srcWidth** – Image width
- **srcHeight** – Image height
- **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2).
- **numContours** – Number of actually found contours
- **maxNumContours** – Maximum number of contours can be found (&lt;= 126)
- **holeFlag** – Hole flag for each found contour to indicate whether it is a hole or not
- **numContourPoints** – Number of points in each found contour
- **contourStartPoints** – Pointers to the start point of each found contour
- **pointBuffer** – Pointer to point buffer for contour points’ coordinates. It should be allocated before calling this function.
- **pointBufferSize** – Size of point buffer in terms of uint32\_t
- **hierarchy** – Information about the image topology. It has numContours elements. For each contour i, the elements hierarchy[i][0], hiearchy[i][1], hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the next and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. If for a contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.
- **contourHandle** – Pointer to assistant and intermediate data. It should be allocated by [fcvFindContoursAllocate()](https://docs.qualcomm.com/doc/80-79511-2/topic/feature_detection.html#a00025_1gaf1f5253f202a848d565982812910c520) and deallocated by [fcvFindContoursDelete()](https://docs.qualcomm.com/doc/80-79511-2/topic/feature_detection.html#a00025_1gacde6ac35845a82848fddc2eac807906a).

- FASTCV\_API void \*fcvFindContoursAllocate(uint32\_t srcStride)

    - Allocates assistant and intermediate data for contour.

- Parameters:

    - **srcStride** – Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2).

- Returns:

    - Pointer to allocated data

- FASTCV\_API void fcvFindContoursDelete(void \*contourHandle)

    - Deallocates assistant and intermediate data for contour.

- Parameters:

    - **contourHandle** – Pointer to assistant and intermediate data

- FASTCV\_API int fcvKDTreeCreate36s8f32(const int8\_t \*\_\_restrict vectors, const [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict invLengths, int numVectors, [fcvKDTreeDatas8f32](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00009.html#_CPPv418fcvKDTreeDatas8f32) \*\*kdtrees)

    - create KDTrees for dataset of 36D vectors

KDTree is very efficient search structure for multidimensional data. Usage: assume we have 36D of type int8\_t data e.g. target image feature descriptors in array named vectors

int8\_t\* descriptors;

the number of descriptors is numVectors

int numDescriptors;

the inverse length of each descriptor in array invLengths

float32\_t\* invLenghts;

pointer to KDTree structure

fcvKDTreeDatas8f32* kdTree = 0;
    Copy to clipboard

kdTree is created as

int err = fcvKDTreeCreate36s8f32( descriptors, invLengths, numDescriptors, kdTree );

- Parameters:

    - - **vectors** – pointer to dataset being array of 36D vectors
- **invLengths** – array of inverse lengths for each vector in the dataset
- **numVectors** – number of 36D vectors in the dataset
- **kdtrees** – address for pointer to the newly created KDTrees

- Returns:

    - 0 - success EINVAL - invalid parameter ENOMEM - not enough memory -1 - other error

- FASTCV\_API int fcvKDTreeDestroy36s8f32([fcvKDTreeDatas8f32](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00009.html#_CPPv418fcvKDTreeDatas8f32) \*kdtrees)

    - release KDTrees data structures

Once we are done with all searches we should release kdTree resources

- Parameters:

    - **kdtrees** – KDTrees to be destroyed

- Returns:

    - 0 - success EINVAL - invalid parameter -1 - other error

- FASTCV\_API int fcvKDTreeQuery36s8f32([fcvKDTreeDatas8f32](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00009.html#_CPPv418fcvKDTreeDatas8f32) \*kdtrees, const int8\_t \*\_\_restrict query, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) queryInvLen, int maxNNs, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) maxDist, int maxChecks, const uint8\_t \*\_\_restrict mask, int32\_t \*numNNsFound, int32\_t \*\_\_restrict NNInds, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict NNDists)

    - find nearest neighbors (NN) for query

Assuming KD tree creation is successful we may start using our kdTree for nearest neighbors (NN) for descriptors of camera features. Let our camera descriptors be in array camDescriptors and their number in numCamDescriptors

int8\_t\* camDescriptors; int numCamDescriptors;

The inverse lengths of descriptors is in

float\* camDescriptorsInvLengths;

Assume we want to find 8 NNs for each camera descriptor. We declare variables for results of NN searches

#define NUM\_NN 8 // number of NN required #define MAX\_CHECKS 32 // max number of checks in kdtree

int32\_t numFound = 0; // for numer of NNs found int32\_t foundInds[ NUM\_NN ]; // for indices to target descriptors float32\_t foundDists[ NUM\_NN ]; // for distances to target descriptors float32\_t maxDist = 0.1f; // max distance to query allowed

the search for NNs for i-th query would be like this

err = fcvKDTreeQuery36s8f32( kdTree, camDescriptors + i \* 36, camDescriptorsInvLengths[ i ], maxDist, MAX\_CHECKS, 0, &numFound, foundInds, foundDists );

where maxDists is an upper bound on distance of NN from the query and MAX\_CHECKS is max number of comparisons of query to target descriptors. The higher MAX\_CHECKS the better NNs we get at the cost of longer search. Assuming everything went fine will return us search results. numFound will contain the number of target descriptors found whose distance to query is less than maxDist. foundInds will contain indices to target descriptors being NNs and foundDists their distances to query.

- Parameters:

    - - **kdtrees** – KDTrees
- **query** – query vector
- **queryInvLen** – inverse length of query vector
- **maxNNs** – max number of NNs to be found
- **maxDist** – max distance between NN and query
- **maxChecks** – max number of leafs to check
- **mask** – array of flags for all vectors in the dataset; may be NULL; if not NULL then its legth must be equal to number of dataset vectors and i-th mask corresponds to i-th vector; values: 0x00 - corresponding vector must not be considered NN regardless of its distance to query 0xFF - corresponding vector may be candidate for NN other - not supported
- **numNNsFound** – for number of NNs found
- **NNInds** – array for indices of found NNs; must have maxNNs length
- **NNDists** – array for NN distances to query; must have maxNNs length

- Returns:

    - 0 - success EINVAL - invalid parameter -1 - other error

- FASTCV\_API void fcvHoughCircleu8(const uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, [fcvCircle](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00003.html#_CPPv49fcvCircle) \*\_\_restrict circles, uint32\_t \*\_\_restrict numCircle, uint32\_t maxCircle, uint32\_t minDist, uint32\_t cannyThreshold, uint32\_t accThreshold, uint32\_t minRadius, uint32\_t maxRadius, void \*\_\_restrict data)

    - Finds circles in a grayscale image using Hough transform.

This function detect circles in a grayscale image. The number is up to maxCircle.
    The radius of circle varies from 0 to max(srcWidth, srcHeight).
    Copy to clipboard

- Parameters:

    - - **src** – 8-bit, single-channel, binary source image. Size of buffer is srcStride\*srcHeight bytes. **WARNING:** should be 128-bit aligned. must be a 1-channel image.
- **srcWidth** – Width of input image, the number of pixels in a row.
- **srcHeight** – Height of input image.
- **srcStride** – Stride of input image(in bytes) is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. **NOTE:** should be a multiple of 8.
- **circles** – Pointer to [fcvCircle](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00003.html#a00003). [fcvCircle](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00003.html#a00003) is a struct including x, y position and radius
- **numCircle** – Pointer to numCircle. numCircle is an algorithm result indicating the number of circle detected by this algorithm.
- **maxCircle** – Maximum number of circles.
- **minDist** – Minimum distance between the centers of the detected circles
- **cannyThreshold** – The higher threshold of the two passed to the Canny() edge detector (the lower one is twice smaller). default is 100.
- **accThreshold** – The accumulator threshold for the circle centers at the detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first. default is 100.
- **minRadius** – Minimum circle radius. default is 0.
- **maxRadius** – Maximum circle radius. default is 0.
- **data** – Pointer to a buffer required by this algorithm. The recommended size is 16 times of input image (16\*srcStride\*srcHeigth in bytes). **WARNING:** should be 128-bit aligned.

- Returns:

    - void

- FASTCV\_API void fcvHoughLineu8(const uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) threshold, uint32\_t maxLines, uint32\_t \*\_\_restrict pNumLines, [fcvLine](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00013.html#_CPPv47fcvLine) \*\_\_restrict pLines)

    - Performs Hough Line detection.

This function detects lines in a grayscale image. The maximum number
     of lines detected is defined by the maxLines parameter.
    Copy to clipboard

- Parameters:

    - - **src** – 8bit, single-channel, binary source image. Size of buffer is srcStride \* srcHeight bytes.
- **srcWidth** – Width of the input image, the number of pixels in a row. should be a multiple of 8.
- **srcHeight** – Input image height in pixels.
- **srcStride** – Stride of input image in bytes is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride will default to srcWidth. **NOTE:** should be a multiple of 8.
- **threshold** – Controls the minimal length of a detected line. Value must be between 0.0 and 1.0 Values close to 1.0 reduces the number of detected lines. Values close to 0.0 detect more lines, but may be noisy. Recommended value is 0.25.
- **maxLines** – Maximum number of lines to be detected.
- **pNumLines** – Number of lines detected. The memory for this array must be allocated by the user of the function.
- **pLines** – Resulting lines detected. The memory for this array must be allocated by the user of the function.

- Returns:

    - void

- FASTCV\_API void fcvImageMomentsu8(const uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, [fcvMoments](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00015.html#_CPPv410fcvMoments) \*moments, uint8\_t binary)

    - Computes weighted average (moment) of the image pixels’ intensities.

This function computes image moment, i.e., a certain particular weighted average (moment) of the image pixels’ intensities, or a function of such moments, usually chosen to have some attractive property or interpretation. Image moments are useful to describe objects after segmentation.

- Parameters:

    - - **src** – Pointer to the original Input 8-bit image. Size of buffer is srcStride\*srcHeight bytes. **NOTE:** should be 128-bit aligned.
- **srcWidth** – The width of the input source image.
- **srcHeight** – The height of the input source image.
- **srcStride** – Stride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. **NOTE:** should be a multiple of 8.
- **moments** – Pointer to the a struct of image moments which is a certain particular weighted average (moment) of the image pixels’ intensities, it includes 18 elements.
- **binary** – if 1, binary image (0x00-black, oxff-white); if 0, grayscale image

- FASTCV\_API void fcvImageMomentss32(const int32\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, [fcvMoments](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00015.html#_CPPv410fcvMoments) \*moments, uint8\_t binary)

    - Computes weighted average (moment) of the image pixels’ intensities.

This function computes image moment, i.e., a certain particular weighted average (moment) of the image pixels’ intensities, or a function of such moments, usually chosen to have some attractive property or interpretation. Image moments are useful to describe objects after segmentation.

- Parameters:

    - - **src** – Pointer to the original input of data type int32\_t. Size of buffer is srcStride\*srcHeight bytes. **NOTE:** should be 128-bit aligned.
- **srcWidth** – The width of the input source image.
- **srcHeight** – The height of the input source image.
- **srcStride** – Stride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth\*4. **NOTE:** should be a multiple of 8.
- **moments** – Pointer to the a struct of image moments which is a certain particular weighted average (moment) of the image pixels’ intensities, it includes 18 elements.
- **binary** – if 1, binary image (0x00-black, oxff-white); if 0, grayscale image

- FASTCV\_API void fcvImageMomentsf32(const [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, [fcvMoments](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00015.html#_CPPv410fcvMoments) \*moments, uint8\_t binary)

    - Computes weighted average (moment) of the image pixels’ intensities.

This function computes image moment, i.e., a certain particular weighted average (moment) of the image pixels’ intensities, or a function of such moments, usually chosen to have some attractive property or interpretation. Image moments are useful to describe objects after segmentation.

- Parameters:

    - - **src** – Pointer to the original Input of data type float32\_t. Size of buffer is srcStride\*srcHeight bytes. **NOTE:** should be 128-bit aligned.
- **srcWidth** – The width of the input source image.
- **srcHeight** – The height of the input source image.
- **srcStride** – Stride of image is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth\*4. **NOTE:** should be a multiple of 8.
- **moments** – Pointer to the a struct of image moments which is a certain particular weighted average (moment) of the image pixels’ intensities, it includes 18 elements.
- **binary** – if 1, binary image (0x00-black, oxff-white); if 0, grayscale image

- FASTCV\_API void fcvImageDetectEdgePixelsu8(const int16\_t \*\_\_restrict gxgy, const uint32\_t \*\_\_restrict mag, uint32\_t gradStride, uint32\_t topLeftX, uint32\_t topLeftY, uint32\_t width, uint32\_t height, uint32\_t gridSize, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) threshold, uint32\_t nEdgePixelsMax, uint32\_t \*\_\_restrict nEdgePixels, uint32\_t \*\_\_restrict coordEdgePixels)

    - Extracts edge locations from the image. This function tests for edges a grid of pixels within a bounding box.

- Parameters:

    - - **gxgy** – Pointer to gradient direction image array containing the interleaved x,y components of the direction vector.
- **mag** – Pointer to gradient magnitude image array stored as a 4-byte unsigned integer per pixel.
- **gradStride** – gradStride is the number of pixels between column 0 of row 1 and column 0 of row 2 in data memory for gxgy and mag. should be multiple of 8
- **topLeftX** – The x coordinate of the top-left corner of the bounding box.
- **topLeftY** – The y coordinate of the top-left corner of the bounding box.
- **width** – The width of the bounding box.
- **height** – The height of the bounding box.
- **gridSize** – The spacing between pixels that are tested for edges.
- **threshold** – The threshold is used for early filtering edge candidate pixels based on gradient magnitude.
- **nEdgePixelsMax** – Maximum number of edge pixels. The function exits when the maximum number of edges is exceeded.
- **nEdgePixels** – Pointer to an integer storing the number of edge pixels detected.
- **coordEdgePixels** – Pointer to the output array containing the interleaved x,y position of the detected edges.

- FASTCV\_API [fcvStatus](https://docs.qualcomm.com/doc/80-79511-2/topic/enum_a00021_1a39574810b4ad6914ee8613424f316283.html#_CPPv49fcvStatus) fcvGLBPu8(const uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, uint32\_t radius, uint32\_t neighbors, uint8\_t \*\_\_restrict dst, uint32\_t dstStride)

    - Computes the Generalized Local Binary Pattern Features for a single channel image.

The function computes the Circular Local Binary Pattern (LBP) Code of each pixel of an input image “src” A number of neighboring pixels “neighbors” are sampled from a circle of radius “radius” around each pixel to compute the LBP code. In this implementation, it is assumed that the number of neighbors vary between 1 & 8. It is also assumed that the dimensions of the output image “dst” is computed as follows from the size of the input image “src”: dstWidth = srcWidth - 2\*radius, and dstHeight = srcHeight - 2\*radius.

- Parameters:

    - - **src** – Input unsigned 8-bit integer image. Size of buffer is srcStride\*srcHeight bytes. **WARNING:** should be 128-bit aligned.
- **srcWidth** – Width of the source image.
- **srcHeight** – Height of the source image.
- **srcStride** – Stride of the Image in bytes. **NOTE:** if 0, srcStride is set as srcWidth. **WARNING:** should be multiple of 8, and at least as much as srcWidth if not 0.
- **radius** – The radius of the circle centered around each pixel. The value of radius specifies the size of the region around each pixel from which the neighbors are sampled.
- **neighbors** – The number of neighbors sampled from the circle around each pixel. **NOTE** : MUST be &gt; 0 and less than or equal to 8.
- **dst** – Output unsigned 8-bit integer image. Size of buffer is dstStride\*srcHeight bytes. The dimensions of the image are dstWidth = srcWidth - 2\*radius, and dstHeight = srcHeight - 2\*radius.
- **dstStride** – Stride of the output image in bytes. **NOTE:** dstWidth = srcWidth - 2\*radius, dstHeight = srcHeight - 2\*radius. **WARNING:** should be multiple of 8, and at least as much as dstWidth if not 0.

- FASTCV\_API [fcvStatus](https://docs.qualcomm.com/doc/80-79511-2/topic/enum_a00021_1a39574810b4ad6914ee8613424f316283.html#_CPPv49fcvStatus) fcvCornerRefineSubPixu8(const uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, uint32\_t blockWidth, uint32\_t blockHeight, uint32\_t maxIterations, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) stopCriteria, const uint32\_t \*\_\_restrict xyInitial, uint32\_t nCorners, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict xyOut)

    - Refine corner location.

Refine the detected corners location into sub-Pixels which is more precise than integer pixels

- Parameters:

    - - **src** – Input uint8\_t image. Size of buffer is srcStride\*srcHeight bytes. **WARNING:** should be 128-bit aligned.
- **srcWidth** – Input image width.
- **srcHeight** – Input image height.
- **srcStride** – Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row
- **blockWidth** – Width of the location search window.
- **blockHeight** – Height of the location search window.
- **maxIterations** – Maximum number of iteration to refine
- **stopCriteria** – Improvement threshold, iteration stop if the corner position moves less by this value
- **xyInitial** – Pointer to the initial input array containing the interleaved x,y position of the corner
- **nCorners** – Number of the corners
- **xyOut** – Pointer to the output array containing the refined interleaved x,y position of the corner

- FASTCV\_API [fcvStatus](https://docs.qualcomm.com/doc/80-79511-2/topic/enum_a00021_1a39574810b4ad6914ee8613424f316283.html#_CPPv49fcvStatus) fcvGoodFeatureToTracku8(const uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) distanceMin, uint32\_t border, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) barrier, uint32\_t \*\_\_restrict xy, uint32\_t maxnumcorners, uint32\_t \*\_\_restrict numcorners)

    - Extract strong corners from image to track.

Extract strong corners from image to track based on the according paper “Good Feature to Track” by J.Shi and C.Tomasi

- Parameters:

    - - **src** – Input uint8\_t image. Size of buffer is srcStride\*srcHeight bytes. **WARNING:** should be 128-bit aligned.
- **srcWidth** – Input image width.
- **srcHeight** – Input image height.
- **srcStride** – Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row
- **distanceMin** – Minimum Euclidean distance between the found corners
- **border** – Number for pixels to ignore from top,bottom
- **barrier** – Quality threshold
- **xy** – Pointer to the output array containing the interleaved x,y position of the detected features
- **maxnumcorners** – Maximum number of features to detect
- **numcorners** – Pointer to integer of actual detected features number

- FASTCV\_API [fcvStatus](https://docs.qualcomm.com/doc/80-79511-2/topic/enum_a00021_1a39574810b4ad6914ee8613424f316283.html#_CPPv49fcvStatus) fcvFindMultipleMaximau8(const uint8\_t \*\_\_restrict src, uint32\_t srcWidth, uint32\_t srcHeight, uint32\_t srcStride, const [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict pos, const [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict normal, uint32\_t maxDistance, uint32\_t maxNumMaxima, int32\_t minGradient, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) maxAngleDiff, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict maxima, uint32\_t \*\_\_restrict numMaxima)

    - Find multiple maxima along the normal direction of the line.

- Parameters:

    - - **src** – 8-bit input image
- **srcWidth** – Input image width
- **srcHeight** – Input image height
- **srcStride** – Input image stride
- **pos** – 2D position to start searching maximas in the input image
- **normal** – Normalized line normal at pos
- **maxDistance** – Search distance along the normal direction; [-normal\*maxDistance, normal\*maxDistance]
- **maxNumMaxima** – Maximum maxima to find, e.g., 5
- **minGradient** – Minimum 1D gradient of the pixels on the search line (normal direction)
- **maxAngleDiff** – Cosine value threshold to filter the pixels that have large angle difference
- **maxima** – List of found maxima 1D positions; Actuall 2D position of maxima = (normal \* 1D position) + pos
- **numMaxima** – Number of found maxima

- Returns:

    - FASTCV\_SUCCESS upon success. Other status codes upon failure.

- FASTCV\_API [fcvStatus](https://docs.qualcomm.com/doc/80-79511-2/topic/enum_a00021_1a39574810b4ad6914ee8613424f316283.html#_CPPv49fcvStatus) fcvImageDetectLineSegmentsu8(const [fcvPyramidLevel\_v2](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00018.html#_CPPv418fcvPyramidLevel_v2) \*\_\_restrict srcPyr, uint32\_t pyrLevel, uint32\_t doBlurImage, [float32\_t](https://docs.qualcomm.com/doc/80-79511-2/topic/typedef_a00021_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) maxLineAngle, uint32\_t minLineLength, uint32\_t minMagnitude, uint32\_t maxLineNum, uint32\_t \*\_\_restrict indexBuffer, [fcvLineSegment](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00014.html#_CPPv414fcvLineSegment) \*\_\_restrict lineSegments, uint32\_t \*\_\_restrict numLineSegments)

    - Extract the straight line segments from the image.

- Parameters:

    - - **srcPyr** – Pointer to an array of [fcvPyramidLevel\_v2](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00018.html#a00018). Only 2 levels at max will be used to extract the straight line segments.
- **pyrLevel** – Image pyramid level, if it is set to 1, then do not use multi-scale approach. pyrLevel should be greater than or equal to 1.
- **doBlurImage** – Do image-blurring inside the function (if the image is not blurred)
- **maxLineAngle** – Cosine threshold to stop following (extending) pixels, e.g., cos(22.5 deg) maxLineAngle should be between [0.5 - 1.0]
- **minLineLength** – Minimum line segment length in pixels
- **minMagnitude** – Minimum pixel gradient magnitude, e.g., 10
- **maxLineNum** – Maximum line segments from the image
- **indexBuffer** – Optionally store the index(:= y \* image\_width + x) of the pixels consisting of the line segments into pointsList in [fcvLineSegment](https://docs.qualcomm.com/doc/80-79511-2/topic/struct_a00014.html#a00014) structure. e.g., One can provide the buffer[maxLineNum\*(image width + height)] Pass NULL if it is not necessary.
- **lineSegments** – List of the detected line segments
- **numLineSegments** – Number of found line segments

- Returns:

    - FASTCV\_SUCCESS upon success. Other status codes upon failure.

Last Published: Aug 30, 2024

[Previous Topic
Color conversion](https://docs.qualcomm.com/bundle/publicresource/80-79511-2/topics/color_conversion.md) [Next Topic
Image processing](https://docs.qualcomm.com/bundle/publicresource/80-79511-2/topics/image_processing.md)