BoundingBox - 2023.2 English

Vitis Libraries

Release Date
2023-12-20
Version
2023.2 English

The boundingbox function highlights the region of interest (ROI) from the input image using below equations.

P(X,Y) ≤ P(xi, yi) ≤ P(X,Y’)

P(X’,Y) ≤ P(xi, yi) ≤ P(X’,Y’)

Where,

  • P(xi, yi) - Current pixel location
  • P(X,Y) - Top left corner of ROI
  • P(X,Y’) - Top right corner of ROI
  • P(X’,Y) - Bottom left corner of ROI
  • P(X’,Y’) - Bottom Right of ROI

API Syntax

template<int SRC_T, int ROWS, int COLS, int MAX_BOXES=1, int NPC=1, int XFCVDEPTH_IN = _XFCVDEPTH_DEFAULT>
void boundingbox(xf::cv::Mat<SRC_T, ROWS, COLS, NPC, XFCVDEPTH_IN> & _src_mat, xf::cv::Rect_<int> *roi , xf::cv::Scalar<4,unsigned char > *color, int num_box)

Parameter Descriptions

The following table describes the template and the function parameters.

Table 331 Table 61. boundingbox Parameter Description
Parameter Description
SRC_T Input pixel Type. Only 8-bit, unsigned, 1 channel and 4 channel is supported (XF_8UC1,XF_8UC4).
ROWS Maximum height of input and output image.
COLS Maximum width of input and output image. Must be multiple of NPC.
MAX_BOXES Maximum number of boxes, fixed to 5.
NPC Number of pixels to be processed per cycle, possible options are XF_NPPC1 only.
XFCVDEPTH_IN Depth of input image
_src_mat Input image
roi ROI is a xf::cv::Rect object that consists of the top left corner of the rectangle along with the height and width of the rectangle.
color The xf::cv::Scalar object consists of color information for each box (ROI).
num_box Number of boxes to be detected. It should be equal or less than MAX_BOXES.

Resource Utilization

The following table summarizes the resource utilization in different configurations, generated using Vivado HLS 2019.1 tool for the Xczu9eg-ffvb1156-1-i-es1 FPGA.

Table 332 Table 62. boundingbox Function Resource Utilization Summary
Operating Mode Operating Frequency (MHz) Utilization Estimate
BRAM_18K DSP_48Es FF LUT CLB
1 Pixel 300 5 4 2521 1649 409

Performance Estimate

The following table summarizes the performance of the kernel in 1-pixel mode as generated using Vivado HLS 2019.1 tool for the Xilinx xczu9eg-ffvb1156-2-i-es2 FPGA to process a grayscale 4K (2160x3840) image for highlighting 3 different boundaries (480x640, 100x200, 300x300).

Table 333 Table 63. boundingbox Function Performance Estimate Summary
Operating Mode Latency Estimate
Max Latency (ms)
1 pixel operation (300 MHz) 0.15

Vitis Vision Reference

The xf::cv::boundingbox is complaint with below Vitis Vision function:

void rectangle(Mat& img, Rect rec, const Scalar& color, int thickness=1, int lineType=8, int shift=0 )