Migrating HLS Video Library to Vitis vision

The HLS video library has been deprecated. All the functions and most of the infrastructure available in HLS video library are now available in Vitis vision with their names changed and some modifications. These HLS video library functions ported to Vitis vision supports build flow also.

This section provides the details on using the C++ video processing functions and the infrastructure present in HLS video library.

Infrastructure Functions and Classes

All the functions imported from HLS video library now take xf::cv::Mat (in sync with Vitis vision library) to represent image data instead of hls::Mat. The main difference between these two is that the hls::Mat uses hls::stream to store the data whereas xf::cv::Mat uses a pointer. Therefore, hls:: Mat cannot be exactly replaced with xf::cv::Mat for migrating.

Below table summarizes the differences between member functions of hls::Mat to xf::cv::Mat.

Table : Infrastructure Functions and Classes
Member Function hls::Mat (HLS Video lib) xf::cv::Mat (Vitis vision lib)
channels() Returns the number of channels Returns the number of channels
type() Returns the enum value of pixel type Returns the enum value of pixel type
depth() Returns the enum value of pixel type Returns the depth of pixel including channels
read() Readout a value and return it as a scalar from stream Readout a value from a given location and return it as a packed (for multi-pixel/clock) value.
operator >> Similar to read() Not available in Vitis vision
operator << Similar to write() Not available in Vitis vision
Write() Write a scalar value into the stream Writes a packed (for multi-pixel/clock) value into the given location.

Infrastructure files available in HLS Video Library hls_video_core.hpp, hls_video_mem.hpp, hls_video_types.hpp are moved to xf_video_core.hpp, xf_video_mem.hpp, xf_video_types.hpp in Vitis vision Library and hls_video_imgbase.hpp is deprecated. Code inside these files unchanged except that these are now under xf::cv::namespace.

Classes

Memory Window Buffer
hls::window is now xf::cv::window. No change in the implementation, except the namespace change. This is located in “xf_video_mem.h” file.
Memory Line Buffer
hls::LineBuffer is now xf::cv::LineBuffer. No difference between the two, except xf::cv::LineBuffer has extra template arguments for inferring different types of RAM structures, for the storage structure used. Default storage type is “RAM_S2P_BRAM” with RESHAPE_FACTOR=1. Complete description can be found here xf::cv::LineBuffer. This is located in xf_video_mem.hpp file.

Funtions

OpenCV interface functions
These functions covert image data of OpenCV Mat format to/from HLS AXI types. HLS Video Library had 14 interface functions, out of which, two functions are available in Vitis vision Library: cvMat2AXIvideo and AXIvideo2cvMat located in “xf_axi.h” file. The rest are all deprecated.
AXI4-Stream I/O Functions
The I/O functions which convert hls::Mat to/from AXI4-Stream compatible data type (hls::stream) are hls::AXIvideo2Mat, hls::Mat2AXIvideo. These functions are now deprecated and added 2 new functions xf::cv::AXIvideo2xfMat and xf::cv:: xfMat2AXIvideo to facilitate the xf::cv::Mat to/from conversion. To use these functions, the header file “xf_infra.hpp” must be included.

xf::cv::window

A template class to represent the 2D window buffer. It has three parameters to specify the number of rows, columns in window buffer and the pixel data type.

Class definition

template<int ROWS, int COLS, typename T>
class Window {
public:
    Window()
   /* Window main APIs */
    void shift_pixels_left();
    void shift_pixels_right();
    void shift_pixels_up();
    void shift_pixels_down();
    void insert_pixel(T value, int row, int col);
    void insert_row(T value[COLS], int row);
    void insert_top_row(T value[COLS]);
    void insert_bottom_row(T value[COLS]);
    void insert_col(T value[ROWS], int col);
    void insert_left_col(T value[ROWS]);
    void insert_right_col(T value[ROWS]);
    T& getval(int row, int col);
    T& operator ()(int row, int col);
    T val[ROWS][COLS];
#ifdef __DEBUG__
    void restore_val();
    void window_print();
    T val_t[ROWS][COLS];
#endif
};

Parameter Descriptions

The following table lists the xf::cv::Window class members and their descriptions.

Table : Window Function Parameter Descriptions
Parameter Description
Val 2-D array to hold the contents of buffer.

Member Function Description

Table : Member Function Description
Function Description
shift_pixels_left() Shift the window left, that moves all stored data within the window right, leave the leftmost column (col = COLS-1) for inserting new data.
shift_pixels_right() Shift the window right, that moves all stored data within the window left, leave the rightmost column (col = 0) for inserting new data.
shift_pixels_up() Shift the window up, that moves all stored data within the window down, leave the top row (row = ROWS-1) for inserting new data.
shift_pixels_down() Shift the window down, that moves all stored data within the window up, leave the bottom row (row = 0) for inserting new data.
insert_pixel(T value, int row, int col) Insert a new element value at location (row, column) of the window.
insert_row(T value[COLS], int row) Inserts a set of values in any row of the window.
insert_top_row(T value[COLS]) Inserts a set of values in the top row = 0 of the window.
insert_bottom_row(T value[COLS]) Inserts a set of values in the bottom row = ROWS-1 of the window.
insert_col(T value[ROWS], int col) Inserts a set of values in any column of the window.
insert_left_col(T value[ROWS]) Inserts a set of values in left column = 0 of the window.
insert_right_col(T value[ROWS]) Inserts a set of values in right column = COLS-1 of the window.
T& getval(int row, int col) Returns the data value in the window at position (row,column).
T& operator ()(int row, int col) Returns the data value in the window at position (row,column).
restore_val() Restore the contents of window buffer to another array.
window_print() Print all the data present in window buffer onto console.

Template Parameter Description

Table : Template Parameter Description
Parameter Description
ROWS Number of rows in the window buffer.
COLS Number of columns in the window buffer.
T Data type of pixel in the window buffer.

Sample code for window buffer declaration

Window<K_ROWS, K_COLS, unsigned char> kernel;

xf::cv::LineBuffer

A template class to represent 2D line buffer. It has three parameters to specify the number of rows, columns in window buffer and the pixel data type.

Class definition

template<int ROWS, int COLS, typename T, XF_ramtype_e MEM_TYPE=RAM_S2P_BRAM, int RESHAPE_FACTOR=1>
 class LineBuffer {
public:
    LineBuffer()
       /* LineBuffer main APIs */
    /* LineBuffer main APIs */
    void shift_pixels_up(int col);
    void shift_pixels_down(int col);
    void insert_bottom_row(T value, int col);
    void insert_top_row(T value, int col);
    void get_col(T value[ROWS], int col);
    T& getval(int row, int col);
    T& operator ()(int row, int col);

    /* Back compatible APIs */
    void shift_up(int col);
    void shift_down(int col);
    void insert_bottom(T value, int col);
    void insert_top(T value, int col);
    T val[ROWS][COLS];
#ifdef __DEBUG__
    void restore_val();
    void linebuffer_print(int col);
    T val_t[ROWS][COLS];
#endif
};

Parameter Descriptions

The following table lists the xf::cv::LineBuffer class members and their descriptions.

Table : Line Buffer Function Parameter Descriptions
Parameter Description
Val 2-D array to hold the contents of line buffer.

Member Functions Description

Table : Member Functions Description
Function Description
shift_pixels_up(int col) Line buffer contents Shift up, new values will be placed in the bottom row=ROWS-1.
shift_pixels_down(int col) Line buffer contents Shift down, new values will be placed in the top row=0.
insert_bottom_row(T value, int col) Inserts a new value in bottom row= ROWS-1 of the line buffer.
insert_top_row(T value, int col) Inserts a new value in top row=0 of the line buffer.
get_col(T value[ROWS], int col) Get a column value of the line buffer.
T& getval(int row, int col) Returns the data value in the line buffer at position (row, column).
T& operator ()(int row, int col); Returns the data value in the line buffer at position (row, column).

Template Parameter Description

Table : Template Parameter Description
Parameter Description
ROWS Number of rows in line buffer.
COLS Number of columns in line buffer.
T Data type of pixel in line buffer.
MEM_TYPE Type of storage element. It takes one of the following enumerated values: RAM_1P_BRAM, RAM_1P_URAM, RAM_2P_BRAM, RAM_2P_URAM, RAM_S2P_BRAM, RAM_S2P_URAM, RAM_T2P_BRAM, RAM_T2P_URAM.
RESHAPE_FACTOR Specifies the amount to divide an array.

Sample code for line buffer declaration:

LineBuffer<3, 1920, XF_8UC3, RAM_S2P_URAM,1>     buff;

Video Processing Functions

The following table summarizes the video processing functions ported from HLS Video Library into Vitis vision Library along with the API modifications.

Table : Video Processing Functions
Functions HLS Video Library -API xfOpenCV Library-API
addS

template<int ROWS, int COLS, int SRC_T, typename _T, int DST_T>

void AddS(Mat<ROWS, COLS, SRC_T>&src,Scalar<HLS_MAT_CN(SRC_T), _T> scl, Mat<ROWS, COLS, DST_T>& dst)

template<int POLICY_TYPE, int SRC_T, int ROWS, int COLS, int NPC =1>

void addS(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1, unsigned char _scl[XF_CHANNELS(SRC_T,NPC)],xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst)

AddWeighted

template<int ROWS, int COLS, int SRC1_T, int SRC2_T, int DST_T, typename P_T>

void AddWeighted(Mat<ROWS, COLS, SRC1_T>& src1,P_T alpha,Mat<ROWS, COLS, SRC2_T>& src2,P_T beta, P_T gamma,Mat<ROWS, COLS, DST_T>& dst)

template< int SRC_T,int DST_T, int ROWS, int COLS, int NPC = 1>

void addWeighted(xf::Mat<SRC_T, ROWS, COLS, NPC> & src1,float alpha, xf::Mat<SRC_T, ROWS, COLS, NPC> & src2,float beta, float gama, xf::Mat<DST_T, ROWS, COLS, NPC> & dst)

Cmp

template<int ROWS, int COLS, int SRC1_T, int SRC2_T, int DST_T>

void Cmp(Mat<ROWS, COLS, SRC1_T>& src1,Mat<ROWS, COLS, SRC2_T>& src2,

Mat<ROWS, COLS, DST_T>& dst,int cmp_op)

template<int CMP_OP, int SRC_T, int ROWS, int COLS, int NPC =1>

void compare(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1, xf::Mat<SRC_T, ROWS, COLS, NPC> & _src2,xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst)

CmpS

template<int ROWS, int COLS, int SRC_T, typename P_T, int DST_T>

void CmpS(Mat<ROWS, COLS, SRC_T>& src, P_T value, Mat<ROWS, COLS, DST_T>& dst, int cmp_op)

template<int CMP_OP, int SRC_T, int ROWS, int COLS, int NPC =1>

void compare(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1, unsigned char _scl[XF_CHANNELS(SRC_T,NPC)],xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst)

Max

template<int ROWS, int COLS, int SRC1_T, int SRC2_T, int DST_T>

void Max(Mat<ROWS, COLS, SRC1_T>& src1,

Mat<ROWS, COLS, SRC2_T>& src2,

Mat<ROWS, COLS, DST_T>& dst)

template<int SRC_T, int ROWS, int COLS, int NPC =1>

void Max(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1, xf::Mat<SRC_T, ROWS, COLS, NPC> & _src2,xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst)

MaxS

template<int ROWS, int COLS, int SRC_T, typename _T, int DST_T>

void MaxS(Mat<ROWS, COLS, SRC_T>& src,

_T value, Mat<ROWS, COLS, DST_T>& dst)

template< int SRC_T, int ROWS, int COLS, int NPC =1>

void max(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1, unsigned char _scl[XF_CHANNELS(SRC_T,NPC)],xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst)

Min

template<int ROWS, int COLS, int SRC1_T, int SRC2_T, int DST_T>

void Min(Mat<ROWS, COLS, SRC1_T>& src1,

Mat<ROWS, COLS, SRC2_T>& src2,

Mat<ROWS, COLS, DST_T>& dst)

template< int SRC_T, int ROWS, int COLS, int NPC =1>

void Min(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1, xf::Mat<SRC_T, ROWS, COLS, NPC> & _src2,xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst)

MinS

template<int ROWS, int COLS, int SRC_T, typename _T, int DST_T>

void MinS(Mat<ROWS, COLS, SRC_T>& src,

_T value,Mat<ROWS, COLS, DST_T>& dst)

template< int SRC_T, int ROWS, int COLS, int NPC =1>

void min(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1, unsigned char _scl[XF_CHANNELS(SRC_T,NPC)],xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst)

PaintMask

template<int SRC_T,int MASK_T,int ROWS,int COLS>

void PaintMask(

Mat<ROWS,COLS,SRC_T> &_src,

Mat<ROWS,COLS,MASK_T>&_mask,

Mat<ROWS,COLS,SRC_T>&_dst,Scalar<HLS_MAT_CN(SRC_T),HLS_TNAME(SRC_T)> _color)

template< int SRC_T,int MASK_T, int ROWS, int COLS,int NPC=1>

void paintmask(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src_mat, xf::Mat<MASK_T, ROWS, COLS, NPC> & in_mask, xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst_mat, unsigned char _color[XF_CHANNELS(SRC_T,NPC)])

Reduce

template<typename INTER_SUM_T, int ROWS, int COLS, int SRC_T, int DST_ROWS, int DST_COLS, int DST_T>

void Reduce(

Mat<ROWS, COLS, SRC_T> &src,

Mat<DST_ROWS, DST_COLS, DST_T> &dst,

int dim,

int op=HLS_REDUCE_SUM)

template< int REDUCE_OP, int SRC_T,int DST_T, int ROWS, int COLS,int ONE_D_HEIGHT, int ONE_D_WIDTH, int NPC=1>

void reduce(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src_mat, xf::Mat<DST_T, ONE_D_HEIGHT, ONE_D_WIDTH, 1> & _dst_mat, unsigned char dim)

Zero

template<int ROWS, int COLS, int SRC_T, int DST_T>

void Zero(Mat<ROWS, COLS, SRC_T>& src,

Mat<ROWS, COLS, DST_T>& dst)

template< int SRC_T, int ROWS, int COLS, int NPC =1>

void zero(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1,xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst)

Sum

template<typename DST_T, int ROWS, int COLS, int SRC_T>

Scalar<HLS_MAT_CN(SRC_T), DST_T> Sum(

Mat<ROWS, COLS, SRC_T>& src)

template< int SRC_T, int ROWS, int COLS, int NPC = 1>

void sum(xf::Mat<SRC_T, ROWS, COLS, NPC> & src1, double sum[XF_CHANNELS(SRC_T,NPC)] )

SubS

template<int ROWS, int COLS, int SRC_T, typename _T, int DST_T>

void SubS(Mat<ROWS, COLS, SRC_T>& src,

Scalar<HLS_MAT_CN(SRC_T), _T> scl,

Mat<ROWS, COLS, DST_T>& dst)

template<int POLICY_TYPE, int SRC_T, int ROWS, int COLS, int NPC =1>

void SubS(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1, unsigned char _scl[XF_CHANNELS(SRC_T,NPC)],xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst)

SubRS

template<int ROWS, int COLS, int SRC_T, typename _T, int DST_T>

void SubRS(Mat<ROWS, COLS, SRC_T>& src,

Scalar<HLS_MAT_CN(SRC_T), _T> scl,

Mat<ROWS, COLS, DST_T>& dst)

template<int POLICY_TYPE, int SRC_T, int ROWS, int COLS, int NPC =1>

void SubRS(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1, unsigned char _scl[XF_CHANNELS(SRC_T,NPC)],xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst)

Set

template<int ROWS, int COLS, int SRC_T, typename _T, int DST_T>

void Set(Mat<ROWS, COLS, SRC_T>& src,

Scalar<HLS_MAT_CN(SRC_T), _T> scl,

Mat<ROWS, COLS, DST_T>& dst)

template< int SRC_T, int ROWS, int COLS, int NPC =1>

void set(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1, unsigned char _scl[XF_CHANNELS(SRC_T,NPC)],xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst)

Absdiff

template<int ROWS, int COLS, int SRC1_T, int SRC2_T, int DST_T>

void AbsDiff(

Mat<ROWS, COLS, SRC1_T>& src1,

Mat<ROWS, COLS, SRC2_T>& src2,

Mat<ROWS, COLS, DST_T>& dst)

template<int SRC_T, int ROWS, int COLS, int NPC =1>

void absdiff(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1,xf::Mat<SRC_T, ROWS, COLS, NPC> & _src2,xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst)

And

template<int ROWS, int COLS, int SRC1_T, int SRC2_T, int DST_T>

void And(

Mat<ROWS, COLS, SRC1_T>& src1,

Mat<ROWS, COLS, SRC2_T>& src2,

Mat<ROWS, COLS, DST_T>& dst)

template<int SRC_T, int ROWS, int COLS, int NPC = 1>

void bitwise_and(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1, xf::Mat<SRC_T, ROWS, COLS, NPC> & _src2, xf::Mat<SRC_T, ROWS, COLS, NPC> &_dst)

Dilate

template<int Shape_type,int ITERATIONS,int SRC_T, int DST_T, typename KN_T,int IMG_HEIGHT,int IMG_WIDTH,int K_HEIGHT,int K_WIDTH>

void Dilate(Mat<IMG_HEIGHT, IMG_WIDTH, SRC_T>&_src,Mat<IMG_HEIGHT, IMG_WIDTH, DST_T&_dst,Window<K_HEIGHT,K_WIDTH,KN_T>&_kernel)

template<int BORDER_TYPE, int TYPE, int ROWS, int COLS,int K_SHAPE,int K_ROWS,int K_COLS, int ITERATIONS, int NPC=1>

void dilate (xf::Mat<TYPE, ROWS, COLS, NPC> & _src, xf::Mat<TYPE, ROWS, COLS, NPC> & _dst,unsigned char _kernel[K_ROWS*K_COLS])

Duplicate

template<int ROWS, int COLS, int SRC_T, int DST_T>

void Duplicate(Mat<ROWS, COLS, SRC_T>& src,Mat<ROWS, COLS, DST_T>& dst1,Mat<ROWS, COLS, DST_T>& dst2)

template<int SRC_T, int ROWS, int COLS,int NPC>

void duplicateMat(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src, xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst1,xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst2)

EqualizeHist

template<int SRC_T, int DST_T,int ROW, int COL>

void EqualizeHist(Mat<ROW, COL, SRC_T>&_src,Mat<ROW, COL, DST_T>&_dst)

template<int SRC_T, int ROWS, int COLS, int NPC = 1>

void equalizeHist(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src,xf::Mat<SRC_T, ROWS, COLS, NPC> & _src1,xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst)

erode

template<int Shape_type,int ITERATIONS,int SRC_T, int DST_T, typename KN_T,int IMG_HEIGHT,int IMG_WIDTH,int K_HEIGHT,int K_WIDTH>

void Erode(Mat<IMG_HEIGHT, IMG_WIDTH, SRC_T>&_src,Mat<IMG_HEIGHT,IMG_WIDTH,DST_T>&_dst,Window<K_HEIGHT,K_WIDTH,KN_T>&_kernel)

template<int BORDER_TYPE, int TYPE, int ROWS, int COLS,int K_SHAPE,int K_ROWS,int K_COLS, int ITERATIONS, int NPC=1>

void erode (xf::Mat<TYPE, ROWS, COLS, NPC> & _src, xf::Mat<TYPE, ROWS, COLS, NPC> & _dst,unsigned char _kernel[K_ROWS*K_COLS])

FASTX

template<int SRC_T,int ROWS,int COLS>

void FASTX(Mat<ROWS,COLS,SRC_T> &_src,

Mat<ROWS,COLS,HLS_8UC1>&_mask,HLS_TNAME(SRC_T)_threshold,bool _nomax_supression)

template<int NMS,int SRC_T,int ROWS, int COLS,int NPC=1>

void fast(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src_mat,xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst_mat,unsigned char _threshold)

Filter2D

template<int SRC_T, int DST_T, typename KN_T, typename POINT_T,

int IMG_HEIGHT,int IMG_WIDTH,int K_HEIGHT,int K_WIDTH>

void Filter2D(Mat<IMG_HEIGHT, IMG_WIDTH, SRC_T> &_src,Mat<IMG_HEIGHT, IMG_WIDTH, DST_T> &_dst,Window<K_HEIGHT,K_WIDTH,KN_T>&_kernel,Point_<POINT_T>anchor)

template<int BORDER_TYPE,int FILTER_WIDTH,int FILTER_HEIGHT, int SRC_T,int DST_T, int ROWS, int COLS,int NPC>

void filter2D(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src_mat,xf::Mat<DST_T, ROWS, COLS, NPC> & _dst_mat,short int filter[FILTER_HEIGHT*FILTER_WIDTH],unsigned char _shift)

GaussianBlur

template<int KH,int KW,typename BORDERMODE,int SRC_T,int DST_T,int ROWS,int COLS>

void GaussianBlur(Mat<ROWS, COLS, SRC_T>

&_src, Mat<ROWS, COLS, DST_T>

&_dst,double sigmaX=0,double sigmaY=0)

template<int FILTER_SIZE, int BORDER_TYPE, int SRC_T, int ROWS, int COLS,int NPC = 1>

void GaussianBlur(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src, xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst, float sigma)

Harris

template<int blockSize,int Ksize,typename KT,int SRC_T,int DST_T,int ROWS,int COLS>

void Harris(Mat<ROWS, COLS, SRC_T>

&_src,Mat<ROWS, COLS, DST_T>&_dst,KT k,int threshold

template<int FILTERSIZE,int BLOCKWIDTH, int NMSRADIUS,int SRC_T,int ROWS, int COLS,int NPC=1,bool USE_URAM=false>

void cornerHarris(xf::Mat<SRC_T, ROWS, COLS, NPC> & src,xf::Mat<SRC_T, ROWS, COLS, NPC> & dst,uint16_t threshold, uint16_t k)

CornerHarris

template<int blockSize,int Ksize,typename KT,int SRC_T,int DST_T,int ROWS,int COLS>

void CornerHarris(

Mat<ROWS, COLS, SRC_T>&_src,Mat<ROWS, COLS, DST_T>&_dst,KT k)

template<int FILTERSIZE,int BLOCKWIDTH, int NMSRADIUS,int SRC_T,int ROWS, int COLS,int NPC=1,bool USE_URAM=false>

void cornerHarris(xf::Mat<SRC_T, ROWS, COLS, NPC> & src,xf::Mat<SRC_T, ROWS, COLS, NPC> & dst,uint16_t threshold, uint16_t k

HoughLines2

template<unsigned int theta,unsigned int rho,typename AT,typename RT,int SRC_T,int ROW,int COL,unsigned int linesMax>

void HoughLines2(Mat<ROW,COL,SRC_T> &_src,

Polar_<AT,RT> (&_lines)[linesMax],unsigned int threshold)

template<unsigned int RHO,unsigned int THETA,int MAXLINES,int DIAG,int MINTHETA,int MAXTHETA,int SRC_T, int ROWS, int COLS,int NPC>

void HoughLines(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src_mat,float outputrho[MAXLINES],float outputtheta[MAXLINES],short threshold,short linesmax)

Integral

template<int SRC_T, int DST_T,

int ROWS,int COLS>

void Integral(Mat<ROWS, COLS, SRC_T>&_src,

Mat<ROWS+1, COLS+1, DST_T>&_sum )

template<int SRC_TYPE,int DST_TYPE, int ROWS, int COLS, int NPC>

void integral(xf::Mat<SRC_TYPE, ROWS, COLS, NPC> & _src_mat, xf::Mat<DST_TYPE, ROWS, COLS, NPC> & _dst_mat)

Merge

template<int ROWS, int COLS, int SRC_T, int DST_T>

void Merge(

Mat<ROWS, COLS, SRC_T>& src0,

Mat<ROWS, COLS, SRC_T>& src1,

Mat<ROWS, COLS, SRC_T>& src2,

Mat<ROWS, COLS, SRC_T>& src3,

Mat<ROWS, COLS, DST_T>& dst)

template<int SRC_T, int DST_T, int ROWS, int COLS, int NPC=1>

void merge(xf::Mat<SRC_T, ROWS, COLS, NPC> &_src1, xf::Mat<SRC_T, ROWS, COLS, NPC> &_src2, xf::Mat<SRC_T, ROWS, COLS, NPC> &_src3, xf::Mat<SRC_T, ROWS, COLS, NPC> &_src4, xf::Mat<DST_T, ROWS, COLS, NPC> &_dst)

MinMaxLoc

template<int ROWS, int COLS, int SRC_T, typename P_T>

void MinMaxLoc(Mat<ROWS, COLS, SRC_T>& src,

P_T* min_val,P_T* max_val,Point& min_loc,

Point& max_loc)

template<int SRC_T,int ROWS,int COLS,int NPC=0>

void minMaxLoc(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src,int32_t *min_value, int32_t *max_value,uint16_t *_minlocx, uint16_t *_minlocy, uint16_t *_maxlocx, uint16_t *_maxlocy )

Mul

template<int ROWS, int COLS, int SRC1_T, int SRC2_T, int DST_T>

void Mul(Mat<ROWS, COLS, SRC1_T>& src1,

Mat<ROWS, COLS, SRC2_T>& src2,

Mat<ROWS, COLS, DST_T>& dst)

template<int POLICY_TYPE, int SRC_T, int ROWS, int COLS, int NPC = 1>

void multiply(xf::Mat<SRC_T, ROWS, COLS, NPC> & src1, xf::Mat<SRC_T, ROWS, COLS, NPC> & src2, xf::Mat<SRC_T, ROWS, COLS, NPC> & dst,float scale)

Not

template<int ROWS, int COLS, int SRC_T, int DST_T>

void Not(Mat<ROWS, COLS, SRC_T>& src,

Mat<ROWS, COLS, DST_T>& dst)

template<int SRC_T, int ROWS, int COLS, int NPC = 1>

void bitwise_not(xf::Mat<SRC_T, ROWS, COLS, NPC> & src, xf::Mat<SRC_T, ROWS, COLS, NPC> & dst)

Range

template<int ROWS, int COLS, int SRC_T, int DST_T, typename P_T>

void Range(Mat<ROWS, COLS, SRC_T>& src,

Mat<ROWS, COLS, DST_T>& dst,

P_T start,P_T end)

template<int SRC_T, int ROWS, int COLS,int NPC=1>

void inRange(xf::Mat<SRC_T, ROWS, COLS, NPC> & src,unsigned char lower_thresh,unsigned char upper_thresh,xf::Mat<SRC_T, ROWS, COLS, NPC> & dst)

Resize

template<int SRC_T, int ROWS,int COLS,int DROWS,int DCOLS>

void Resize (

Mat<ROWS, COLS, SRC_T> &_src,

Mat<DROWS, DCOLS, SRC_T> &_dst,

int interpolation=HLS_INTER_LINEAR )

template<int INTERPOLATION_TYPE, int TYPE, int SRC_ROWS, int SRC_COLS, int DST_ROWS, int DST_COLS, int NPC, int MAX_DOWN_SCALE>

void resize (xf::Mat<TYPE, SRC_ROWS, SRC_COLS, NPC> & _src, xf::Mat<TYPE, DST_ROWS, DST_COLS, NPC> & _dst)

sobel

template<int XORDER, int YORDER, int SIZE, int SRC_T, int DST_T, int ROWS,int COLS,int DROWS,int DCOLS>

void Sobel (Mat<ROWS, COLS, SRC_T>

&_src,Mat<DROWS, DCOLS, DST_T> &_dst)

template<int BORDER_TYPE,int FILTER_TYPE, int SRC_T,int DST_T, int ROWS, int COLS,int NPC=1,bool USE_URAM = false>

void Sobel(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src_mat,xf::Mat<DST_T, ROWS, COLS, NPC> & _dst_matx,xf::Mat<DST_T, ROWS, COLS, NPC> & _dst_maty)

split

template<int ROWS, int COLS, int SRC_T, int DST_T>

void Split(

Mat<ROWS, COLS, SRC_T>& src,

Mat<ROWS, COLS, DST_T>& dst0,

Mat<ROWS, COLS, DST_T>& dst1,

Mat<ROWS, COLS, DST_T>& dst2,

Mat<ROWS, COLS, DST_T>& dst3)

template<int SRC_T, int DST_T, int ROWS, int COLS, int NPC=1>

void extractChannel(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src_mat, xf::Mat<DST_T, ROWS, COLS, NPC> & _dst_mat, uint16_t _channel)

Threshold

template<int ROWS, int COLS, int SRC_T, int DST_T>

void Threshold(

Mat<ROWS, COLS, SRC_T>& src,

Mat<ROWS, COLS, DST_T>& dst,

HLS_TNAME(SRC_T) thresh,

HLS_TNAME(DST_T) maxval,

int thresh_type)

template<int THRESHOLD_TYPE, int SRC_T, int ROWS, int COLS,int NPC=1>

void Threshold(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src_mat,xf::Mat<SRC_T, ROWS, COLS, NPC> & _dst_mat,short int thresh,short int maxval )

Scale

template<int ROWS, int COLS, int SRC_T, int DST_T, typename P_T>

void Scale(Mat<ROWS, COLS, SRC_T>& src,Mat<ROWS, COLS, DST_T>& dst, P_T scale=1.0,P_T shift=0.0)

template< int SRC_T,int DST_T, int ROWS, int COLS, int NPC = 1>

void scale(xf::Mat<SRC_T, ROWS, COLS, NPC> & src1, xf::Mat<DST_T, ROWS, COLS, NPC> & dst,float scale, float shift)

InitUndistortRectifyMapInverse

template<typename CMT, typename DT, typename ICMT, int ROWS, int COLS, int MAP1_T, int MAP2_T, int N>

void InitUndistortRectifyMapInverse (

Window<3,3, CMT> cameraMatrix,DT(&distCoeffs)[N],Window<3,3, ICMT> ir, Mat<ROWS, COLS, MAP1_T> &map1,Mat<ROWS, COLS, MAP2_T> &map2,int noRotation=false)

template< int CM_SIZE, int DC_SIZE, int MAP_T, int ROWS, int COLS, int NPC >

void InitUndistortRectifyMapInverse (

ap_fixed<32,12> *cameraMatrix,

ap_fixed<32,12> *distCoeffs,

ap_fixed<32,12> *ir,

xf::Mat<MAP_T, ROWS, COLS, NPC> &_mapx_mat,xf::Mat<MAP_T, ROWS, COLS, NPC> &_mapy_mat,int _cm_size, int _dc_size)

Avg, mean, AvgStddev

template<typename DST_T, int ROWS, int COLS, int SRC_T>

DST_T Mean(Mat<ROWS, COLS, SRC_T>& src)

template<int SRC_T,int ROWS, int COLS,int NPC=1>void meanStdDev(xf::Mat<SRC_T, ROWS, COLS, NPC> & _src,unsigned short* _mean,unsigned short* _stddev)
CvtColor

template<typename CONVERSION,int SRC_T, int DST_T,int ROWS,int COLS>

void CvtColor(Mat<ROWS, COLS, SRC_T> &_src,

Mat<ROWS, COLS, DST_T> &_dst)

Color Conversion

Note: All the functions except Reduce can process N-pixels per clock where N is power of 2.