Qualcomm FastCV Library
1.7.1
|
Functions | |
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. | |
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. | |
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. | |
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. | |
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). | |
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. | |
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). | |
FASTCV_API void | fcvCornerHarrisAdaptiveu8 (const uint8_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, uint32_t border, float32_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. | |
FASTCV_API fcvStatus | fcvCornerHarrisScoreu8 (const uint8_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, float32_t *__restrict harrisResp, uint32_t respStride, uint32_t *__restrict xy, uint32_t nCornersMax, uint32_t *__restrict nCorners, float32_t threshold, float32_t sensitivity, uint32_t kernelSize, uint32_t blockSize, uint32_t nmsEnabled, float32_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. . | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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 <descDB, descDBInvLenQ38 > according to descDBTargetId. | |
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. | |
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[][4], 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. | |
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. | |
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[][4], 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. | |
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[][4], void *contourHandle) |
Finds contours in a binary image and reconstructs a full hierarchy of nested contours. | |
FASTCV_API void * | fcvFindContoursAllocate (uint32_t srcStride) |
Allocates assistant and intermediate data for contour. | |
FASTCV_API void | fcvFindContoursDelete (void *contourHandle) |
Deallocates assistant and intermediate data for contour. | |
FASTCV_API int | fcvKDTreeCreate36s8f32 (const int8_t *__restrict vectors, const float32_t *__restrict invLengths, int numVectors, fcvKDTreeDatas8f32 **kdtrees) |
create KDTrees for dataset of 36D vectors | |
FASTCV_API int | fcvKDTreeDestroy36s8f32 (fcvKDTreeDatas8f32 *kdtrees) |
release KDTrees data structures | |
FASTCV_API int | fcvKDTreeQuery36s8f32 (fcvKDTreeDatas8f32 *kdtrees, const int8_t *__restrict query, float32_t queryInvLen, int maxNNs, float32_t maxDist, int maxChecks, const uint8_t *__restrict mask, int32_t *numNNsFound, int32_t *__restrict NNInds, float32_t *__restrict NNDists) |
find nearest neighbors (NN) for query | |
FASTCV_API void | fcvHoughCircleu8 (const uint8_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, fcvCircle *__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. | |
FASTCV_API void | fcvHoughLineu8 (const uint8_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, float32_t threshold, uint32_t maxLines, uint32_t *__restrict pNumLines, fcvLine *__restrict pLines) |
Performs Hough Line detection. | |
FASTCV_API void | fcvImageMomentsu8 (const uint8_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, fcvMoments *moments, uint8_t binary) |
Computes weighted average (moment) of the image pixels' intensities. | |
FASTCV_API void | fcvImageMomentss32 (const int32_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, fcvMoments *moments, uint8_t binary) |
Computes weighted average (moment) of the image pixels' intensities. | |
FASTCV_API void | fcvImageMomentsf32 (const float32_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, fcvMoments *moments, uint8_t binary) |
Computes weighted average (moment) of the image pixels' intensities. | |
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 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. | |
FASTCV_API fcvStatus | 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. | |
FASTCV_API fcvStatus | 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 stopCriteria, const uint32_t *__restrict xyInitial, uint32_t nCorners, float32_t *__restrict xyOut) |
Refine corner location. | |
FASTCV_API fcvStatus | fcvGoodFeatureToTracku8 (const uint8_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, float32_t distanceMin, uint32_t border, float32_t barrier, uint32_t *__restrict xy, uint32_t maxnumcorners, uint32_t *__restrict numcorners) |
Extract strong corners from image to track. | |
FASTCV_API fcvStatus | fcvFindMultipleMaximau8 (const uint8_t *__restrict src, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcStride, const float32_t *__restrict pos, const float32_t *__restrict normal, uint32_t maxDistance, uint32_t maxNumMaxima, int32_t minGradient, float32_t maxAngleDiff, float32_t *__restrict maxima, uint32_t *__restrict numMaxima) |
Find multiple maxima along the normal direction of the line. | |
FASTCV_API fcvStatus | fcvImageDetectLineSegmentsu8 (const fcvPyramidLevel_v2 *__restrict srcPyr, uint32_t pyrLevel, uint32_t doBlurImage, float32_t maxLineAngle, uint32_t minLineLength, uint32_t minMagnitude, uint32_t maxLineNum, uint32_t *__restrict indexBuffer, fcvLineSegment *__restrict lineSegments, uint32_t *__restrict numLineSegments) |
Extract the straight line segments from the image. |
Fast corner detection, harris corner detection, canny edge detection, etc.
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.
[in] | xy | 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....] |
[in] | numPoints | Number of points in the array. |
[out] | rectTopLeftX | Lower left's X value for the rectangle. |
[out] | rectTopLeftY | Lower Left's Y value for the rectangle; |
[out] | rectWidth | Width of the rectangle. |
[out] | rectHeight | Height of the rectangle. |
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.
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 < 3, it will be default to 3. WARNING: srcWidth and srcHeight must be > 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 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.
src | pointer to grayscale image with one byte per pixel WARNING: should be 128-bit aligned. |
srcWidth | image width WARNING: must be <= 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 < 3, it will be default to 3. WARNING: srcWidth and srcHeight must be > 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 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.
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 < 3, it will be default to 3. WARNING: srcWidth and srcHeight must be > 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 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.
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 <= 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 < 3, it will be default to 3. WARNING: srcWidth and srcHeight must be > 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 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.
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 <= 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 < 3, it will be default to 3. WARNING: srcWidth and srcHeight must be > 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 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() 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.
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 < 3, it will be default to 3. WARNING: srcWidth and srcHeight must be > 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 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.
src | pointer to grayscale image with one byte per pixel WARNING: should be 128-bit aligned. |
srcWidth | image width WARNING: must be <= 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 < 3, it will be default to 3. WARNING: srcWidth and srcHeight must be > 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 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.
src | 8-bit image NOTE: should be 128-bit aligned. |
srcWidth | Image width NOTE: should be a multiple of 8. WARNING: must be <= 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 < 3, it will be default to 3. WARNING: srcWidth and srcHeight must be > 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 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() 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.
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 < 3, it will be default to 3. WARNING: srcWidth and srcHeight must be > 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 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.
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 <= 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 < 3, it will be default to 3. WARNING: srcWidth and srcHeight must be > 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 fcvCornerHarrisAdaptiveu8 | ( | const uint8_t *__restrict | src, |
uint32_t | srcWidth, | ||
uint32_t | srcHeight, | ||
uint32_t | srcStride, | ||
uint32_t | border, | ||
float32_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.
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 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).
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. |
FASTCV_API fcvStatus fcvCornerHarrisScoreu8 | ( | const uint8_t *__restrict | src, |
uint32_t | srcWidth, | ||
uint32_t | srcHeight, | ||
uint32_t | srcStride, | ||
float32_t *__restrict | harrisResp, | ||
uint32_t | respStride, | ||
uint32_t *__restrict | xy, | ||
uint32_t | nCornersMax, | ||
uint32_t *__restrict | nCorners, | ||
float32_t | threshold, | ||
float32_t | sensitivity, | ||
uint32_t | kernelSize, | ||
uint32_t | blockSize, | ||
uint32_t | nmsEnabled, | ||
float32_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.
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. |
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).
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. |
FASTCV_API fcvStatus 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 | stopCriteria, | ||
const uint32_t *__restrict | xyInitial, | ||
uint32_t | nCorners, | ||
float32_t *__restrict | xyOut | ||
) |
Refine corner location.
Refine the detected corners location into sub-Pixels which is more precise than integer pixels
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 void* fcvFindContoursAllocate | ( | uint32_t | srcStride | ) |
Allocates assistant and intermediate data for contour.
srcStride | Stride of image (i.e., how many pixels between column 0 of row 1 and column 0 of row 2). |
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[][4], | ||
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.
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 (<= 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() and deallocated by fcvFindContoursDelete(). |
FASTCV_API void fcvFindContoursDelete | ( | void * | contourHandle | ) |
Deallocates assistant and intermediate data for contour.
contourHandle | Pointer to assistant and intermediate data |
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[][4], | ||
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.
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() and deallocated by fcvFindContoursDelete(). |
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.
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() and deallocated by fcvFindContoursDelete(). |
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[][4], | ||
void * | contourHandle | ||
) |
Finds contours in a binary image and reconstructs a full hierarchy of nested contours.
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 (<= 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() and deallocated by fcvFindContoursDelete(). |
FASTCV_API fcvStatus fcvFindMultipleMaximau8 | ( | const uint8_t *__restrict | src, |
uint32_t | srcWidth, | ||
uint32_t | srcHeight, | ||
uint32_t | srcStride, | ||
const float32_t *__restrict | pos, | ||
const float32_t *__restrict | normal, | ||
uint32_t | maxDistance, | ||
uint32_t | maxNumMaxima, | ||
int32_t | minGradient, | ||
float32_t | maxAngleDiff, | ||
float32_t *__restrict | maxima, | ||
uint32_t *__restrict | numMaxima | ||
) |
Find multiple maxima along the normal direction of the line.
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 |
FASTCV_API fcvStatus 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.
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 > 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 fcvGoodFeatureToTracku8 | ( | const uint8_t *__restrict | src, |
uint32_t | srcWidth, | ||
uint32_t | srcHeight, | ||
uint32_t | srcStride, | ||
float32_t | distanceMin, | ||
uint32_t | border, | ||
float32_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
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 |
Maximum number of features to detect
Pointer to integer of actual detected features number
FASTCV_API void fcvHoughCircleu8 | ( | const uint8_t *__restrict | src, |
uint32_t | srcWidth, | ||
uint32_t | srcHeight, | ||
uint32_t | srcStride, | ||
fcvCircle *__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).
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. fcvCircle 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. |
FASTCV_API void fcvHoughLineu8 | ( | const uint8_t *__restrict | src, |
uint32_t | srcWidth, | ||
uint32_t | srcHeight, | ||
uint32_t | srcStride, | ||
float32_t | threshold, | ||
uint32_t | maxLines, | ||
uint32_t *__restrict | pNumLines, | ||
fcvLine *__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.
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. |
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 | 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.
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 fcvImageDetectLineSegmentsu8 | ( | const fcvPyramidLevel_v2 *__restrict | srcPyr, |
uint32_t | pyrLevel, | ||
uint32_t | doBlurImage, | ||
float32_t | maxLineAngle, | ||
uint32_t | minLineLength, | ||
uint32_t | minMagnitude, | ||
uint32_t | maxLineNum, | ||
uint32_t *__restrict | indexBuffer, | ||
fcvLineSegment *__restrict | lineSegments, | ||
uint32_t *__restrict | numLineSegments | ||
) |
Extract the straight line segments from the image.
srcPyr | Pointer to an array of fcvPyramidLevel_v2. 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 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 |
FASTCV_API void fcvImageMomentsf32 | ( | const float32_t *__restrict | src, |
uint32_t | srcWidth, | ||
uint32_t | srcHeight, | ||
uint32_t | srcStride, | ||
fcvMoments * | 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.
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 fcvImageMomentss32 | ( | const int32_t *__restrict | src, |
uint32_t | srcWidth, | ||
uint32_t | srcHeight, | ||
uint32_t | srcStride, | ||
fcvMoments * | 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.
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 fcvImageMomentsu8 | ( | const uint8_t *__restrict | src, |
uint32_t | srcWidth, | ||
uint32_t | srcHeight, | ||
uint32_t | srcStride, | ||
fcvMoments * | 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.
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 int fcvKDTreeCreate36s8f32 | ( | const int8_t *__restrict | vectors, |
const float32_t *__restrict | invLengths, | ||
int | numVectors, | ||
fcvKDTreeDatas8f32 ** | 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;
kdTree is created as
int err = fcvKDTreeCreate36s8f32( descriptors, invLengths, numDescriptors, kdTree );
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 |
FASTCV_API int fcvKDTreeDestroy36s8f32 | ( | fcvKDTreeDatas8f32 * | kdtrees | ) |
release KDTrees data structures
Once we are done with all searches we should release kdTree resources
kdtrees | KDTrees to be destroyed |
FASTCV_API int fcvKDTreeQuery36s8f32 | ( | fcvKDTreeDatas8f32 * | kdtrees, |
const int8_t *__restrict | query, | ||
float32_t | queryInvLen, | ||
int | maxNNs, | ||
float32_t | maxDist, | ||
int | maxChecks, | ||
const uint8_t *__restrict | mask, | ||
int32_t * | numNNsFound, | ||
int32_t *__restrict | NNInds, | ||
float32_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.
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 |
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.
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. |
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.
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 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 <descDB, descDBInvLenQ38 > according to descDBTargetId.
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 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.
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 |