Features from accelerated segment test (FAST) is a corner detection algorithm, that is faster than most of the other feature detectors.
The fast
function picks up a pixel in the image and compares the
intensity of 16 pixels in its neighborhood on a circle, called the
Bresenham’s circle. If the intensity of 9 contiguous pixels is found to
be either more than or less than that of the candidate pixel by a given
threshold, then the pixel is declared as a corner. Once the corners are
detected, the non-maximal suppression is applied to remove the weaker
corners.
This function can be used for both still images and videos. The corners are marked in the image. If the corner is found in a particular location, that location is marked with 255, otherwise it is zero.
API Syntax
template<int NMS,int SRC_T,int ROWS, int COLS,int NPC=1, int XFCVDEPTH_IN_1 = _XFCVDEPTH_DEFAULT, int XFCVDEPTH_OUT_1 = _XFCVDEPTH_DEFAULT>
void fast(xf::cv::Mat<SRC_T, ROWS, COLS, NPC, XFCVDEPTH_IN_1> & _src_mat,xf::cv::Mat<SRC_T, ROWS, COLS, NPC, XFCVDEPTH_OUT_1> & _dst_mat,unsigned char _threshold)
Parameter Descriptions
The following table describes the template and the function parameters.
Parameter | Description |
---|---|
NMS | If NMS == 1, non-maximum suppression is applied to detected corners (keypoints). The value should be 0 or 1. |
SRC_T | Input pixel type. Only 8-bit, unsigned, 1-channel is supported (XF_8UC1) |
ROWS | Maximum height of input image. |
COLS | Maximum width of input image (must be a multiple of 8, for 8-pixel operation) |
NPC | Number of pixels to be processed per cycle; possible options are XF_NPPC1 and XF_NPPC8 for 1 pixel and 8 pixel operations respectively. |
XFCVDEPTH_IN_1 | Depth of the input image. |
XFCVDEPTH_OUT_1 | Depth of the output image. |
_src_mat | Input image |
_dst_mat | Output image. The corners are marked in the image. |
_threshol d | Threshold on the intensity difference between the center pixel and its neighbors. Usually it is taken around 20. |
Resource Utilization
The following table summarizes the resource utilization of the kernel for different configurations, generated using Vivado HLS 2019.1 for the Xczu9eg-ffvb1156-1-i-es1 FPGA, to process a grayscale HD (1080x1920) image with NMS.
Name | Resource Utilization | |
---|---|---|
1 pixel per clock operation | 8 pixel per clock operation | |
300 MHz | 150 MHz | |
BRAM_18K | 10 | 20 |
DSP48E | 0 | 0 |
FF | 2695 | 7310 |
LUT | 3792 | 20956 |
CLB | 769 | 3519 |
Performance Estimate
The following table summarizes the performance of kernel for different configurations, as generated using Vivado HLS 2019.1 tool for the Xczu9eg-ffvb1156-1-i-es1, to process a grayscale HD (1080x1920) image with non-maximum suppression (NMS).
Operating Mode | Operating Frequency (MHz) | Filter Size | Latency Estimate |
---|---|---|---|
Max (ms) | |||
1 pixel | 300 | 3x3 | 7 |
8 pixel | 150 | 3x3 | 1.86 |