.. meta:: :keywords: Vision, Library, Vitis Vision Library, cv :description: Using the Vitis vision library. :xlnxdocumentclass: Document :xlnxdocumenttype: Tutorials Using the Vitis vision Library =============================== This section describes using the Vitis vision library in the Vitis development environment. Note: The instructions in this section assume that you have downloaded and installed all the required packages. *include* folder constitutes all the necessary components to build a Computer Vision or Image Processing pipeline using the library. The folders *common* and *core* contain the infrastructure that the library functions need for basic functions, Mat class, and macros. The library functions are categorized into 4 folders, *features*, *video*, *dnn*, and *imgproc* based on the operation they perform. The names of the folders are self-explanatory. To work with the library functions, you need to include the path to the the *include* folder in the Vitis project. You can include relevant header files for the library functions you will be working with after you source the *include* folder’s path to the compiler. For example, if you would like to work with Harris Corner Detector and Bilateral Filter, you must use the following lines in the host code: .. code:: c #include “features/xf_harris.hpp” //for Harris Corner Detector #include “imgproc/xf_bilateral_filter.hpp” //for Bilateral Filter #include “video/xf_kalmanfilter.hpp” After the headers are included, you can work with the library functions as described in the `Vitis vision Library API Reference `__ using the examples in the examples folder as reference. The following table gives the name of the header file, including the folder name, which contains the library function. .. table:: Table : Vitis Vision Library +-------------------------------------------+-----------------------------------+ | Function Name | File Path in the include folder | +===========================================+===================================+ | xf::cv::accumulate | imgproc/xf_accumulate_image.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::accumulateSquare | imgproc/xf_accumulate_squared.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::accumulateWeighted | imgproc/xf_accumulate_weighted.hp | | | p | +-------------------------------------------+-----------------------------------+ | xf::cv::absdiff, xf::cv::add, | core/xf_arithm.hpp | | xf::cv::subtract, xf::cv::bitwise_and, | | | xf::cv::bitwise_or, xf::cv::bitwise_not, | | | xf::cv::bitwise_xor,xf::cv::multiply | | | ,xf::cv::Max, xf::cv::Min,xf::cv::compare,| | | xf::cv::zero, xf::cv::addS, xf::cv::SubS, | | | xf::cv::SubRS ,xf::cv::compareS, | | | xf::cv::MaxS, xf::cv::MinS, xf::cv::set | | +-------------------------------------------+-----------------------------------+ | xf::cv::addWeighted | imgproc/xf_add_weighted.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::autowhitebalance | imgproc/xf_autowhitebalance.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::bilateralFilter | imgproc/xf_histogram.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::boxFilter | imgproc/xf_box_filter.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::boundingbox | imgproc/xf_boundingbox.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::badpixelcorrection | imgproc/xf_bpc.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::Canny | imgproc/xf_canny.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::Colordetect | imgproc/xf_colorthresholding.hpp, | | | imgproc/xf_bgr2hsv.hpp, | | | imgproc/xf_erosion.hpp, | | | imgproc/xf_dilation.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::merge | imgproc/xf_channel_combine.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::extractChannel | imgproc/xf_channel_extract.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::convertTo | imgproc/xf_convert_bitdepth.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::crop | imgproc/xf_crop.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::filter2D | imgproc/xf_custom_convolution.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::nv122iyuv, xf::cv::nv122rgba, | imgproc/xf_cvt_color.hpp | | xf::cv::nv122yuv4, xf::cv::nv212iyuv, | | | xf::cv::nv212rgba, xf::cv::nv212yuv4, | | | xf::cv::rgba2yuv4, xf::cv::rgba2iyuv, | | | xf::cv::rgba2nv12, xf::cv::rgba2nv21, | | | xf::cv::uyvy2iyuv, xf::cv::uyvy2nv12, | | | xf::cv::uyvy2rgba, xf::cv::yuyv2iyuv, | | | xf::cv::yuyv2nv12, xf::cv::yuyv2rgba, | | | xf::cv::rgb2iyuv,xf::cv::rgb2nv12, | | | xf::cv::rgb2nv21, xf::cv::rgb2yuv4, | | | xf::cv::rgb2uyvy, xf::cv::rgb2yuyv, | | | xf::cv::rgb2bgr, xf::cv::bgr2uyvy, | | | xf::cv::bgr2yuyv, xf::cv::bgr2rgb, | | | xf::cv::bgr2nv12, xf::cv::bgr2nv21, | | | xf::cv::iyuv2nv12, xf::cv::iyuv2rgba, | | | xf::cv::iyuv2rgb, xf::cv::iyuv2yuv4, | | | xf::cv::nv122uyvy, xf::cv::nv122yuyv, | | | xf::cv::nv122nv21, xf::cv::nv212rgb, | | | xf::cv::nv212bgr, xf::cv::nv212uyvy, | | | xf::cv::nv212yuyv, xf::cv::nv212nv12, | | | xf::cv::uyvy2rgb, xf::cv::uyvy2bgr, | | | xf::cv::uyvy2yuyv, xf::cv::yuyv2rgb, | | | xf::cv::yuyv2bgr, xf::cv::yuyv2uyvy, | | | xf::cv::rgb2gray, xf::cv::bgr2gray, | | | xf::cv::gray2rgb, xf::cv::gray2bgr, | | | xf::cv::rgb2xyz, xf::cv::bgr2xyz... | | +-------------------------------------------+-----------------------------------+ | xf::cv::dilate | imgproc/xf_dilation.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::demosaicing | imgproc/xf_demosaicing.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::erode | imgproc/xf_erosion.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::fast | features/xf_fast.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::GaussianBlur | imgproc/xf_gaussian_filter.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::gaincontrol | imgproc/xf_gaincontrol.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::gammacorrection | imgproc/xf_gammacorrection | +-------------------------------------------+-----------------------------------+ | xf::cv::cornerHarris | features/xf_harris.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::calcHist | imgproc/xf_histogram.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::equalizeHist | imgproc/xf_hist_equalize.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::HOGDescriptor | imgproc/xf_hog_descriptor.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::Houghlines | imgproc/xf_houghlines.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::inRange | imgproc/xf_inrange.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::integralImage | imgproc/xf_integral_image.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::densePyrOpticalFlow | video/xf_pyr_dense_optical_flow.h | | | pp | +-------------------------------------------+-----------------------------------+ | xf::cv::DenseNonPyrLKOpticalFlow | video/xf_dense_npyr_optical_flow. | | | hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::LUT | imgproc/xf_lut.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::KalmanFilter | video/xf_kalmanfilter.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::magnitude | core/xf_magnitude.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::MeanShift | imgproc/xf_mean_shift.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::meanStdDev | core/xf_mean_stddev.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::medianBlur | imgproc/xf_median_blur.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::minMaxLoc | core/xf_min_max_loc.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::OtsuThreshold | imgproc/xf_otsuthreshold.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::phase | core/xf_phase.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::preProcess | dnn/xf_pre_process.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::paintmask | imgproc/xf_paintmask.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::pyrDown | imgproc/xf_pyr_down.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::pyrUp | imgproc/xf_pyr_up.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::reduce | imgrpoc/xf_reduce.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::remap | imgproc/xf_remap.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::resize | imgproc/xf_resize.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::convertScaleAbs | imgproc/xf_convertscaleabs.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::Scharr | imgproc/xf_scharr.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::SemiGlobalBM | imgproc/xf_sgbm.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::Sobel | imgproc/xf_sobel.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::StereoPipeline | imgproc/xf_stereo_pipeline.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::sum | imgproc/xf_sum.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::StereoBM | imgproc/xf_stereoBM.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::SVM | imgproc/xf_svm.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::Threshold | imgproc/xf_threshold.hpp | +-------------------------------------------+-----------------------------------+ | xf::cv::warpTransform | imgproc/xf_warp_transform.hpp | +-------------------------------------------+-----------------------------------+ Changing the Hardware Kernel Configuration ------------------------------------------ Update the /vision/L1/examples//build/xf_config_params.h file. Using the Vitis vision Library Functions on Hardware ---------------------------------------------------- The following table lists the Vitis vision library functions and the command to run the respective examples on hardware. It is assumed that your design is completely built and the board has booted up correctly. .. table:: Table : Using the Vitis vision Library Function on Hardware +--------------+---------------------------+--------------------------+ | Example | Function Name | Usage on Hardware | +==============+===========================+==========================+ | accumulate | xf::cv::accumulate | ./.elf | | | | | | | | | +--------------+---------------------------+--------------------------+ | accumulatesq | xf::cv::accumulateSquare | ./.elf | | uared | | | | | | | +--------------+---------------------------+--------------------------+ | accumulatewe |xf::cv::accumulateWeighted | ./.elf | | ighted | | | | | | | +--------------+---------------------------+--------------------------+ | addS | xf::cv::addS | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | arithm | xf::cv::absdiff, | ./.elf | | | xf::cv::subtract, | | | | xf::cv::bitwise_and, | | | | xf::cv::bitwise_or, | | | | xf::cv::bitwise_not, | | | | xf::cv::bitwise_xor | | +--------------+---------------------------+--------------------------+ | addweighted | xf::cv::addWeighted | ./.elf | | | | | | | | | +--------------+---------------------------+--------------------------+ | Autowhite | xf::cv::autowhitebalance | ./.elf | | balance | | | +--------------+---------------------------+--------------------------+ | Bilateralfil | xf::cv::bilateralFilter | ./.elf | | ter | | | +--------------+---------------------------+--------------------------+ | Boxfilter | xf::cv::boxFilter | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Badpixelcorr | xf::cv::badpixelcorrection| ./.elf | | ection | | | +--------------+---------------------------+--------------------------+ | Boundingbox | xf::cv::boundingbox | ./.elf | | | | | | | | | +--------------+---------------------------+--------------------------+ | Canny | xf::cv::Canny | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | channelcombi | xf::cv::merge | ./.elf | | ne | | | | | | | | | | | | | | | +--------------+---------------------------+--------------------------+ | Channelextra | xf::cv::extractChannel | ./.elf | | ct | | | +--------------+---------------------------+--------------------------+ | Colordetect | xf::cv::bgr2hsv, | ./.elf | | | xf::cv::colorthresholding,| | | | xf::cv:: erode, xf::cv:: | | | | dilate | | +--------------+---------------------------+--------------------------+ | compare | xf::cv::compare | ./.elf | | | | | | | | | +--------------+---------------------------+--------------------------+ | compareS | xf::cv::compareS | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Convertbitde | xf::cv::convertTo | ./.elf | | pth | | | +--------------+---------------------------+--------------------------+ | convertScale | xf::cv::convertScaleAbs | ./.elf | | Abs | | | +--------------+---------------------------+--------------------------+ | Cornertracke | xf::cv::cornerTracker | ./exe | +--------------+---------------------------+--------------------------+ | crop | xf::cv::crop | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Customconv | xf::cv::filter2D | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::iyuv2nv12 | ./.elf | | IYUV2NV12 | | | | | | | | | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::iyuv2rgba | ./.elf | | IYUV2RGBA | | | | | | | | | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::iyuv2yuv4 | ./.elf | | IYUV2YUV4 | | | | | | | | | | | | | | | | | | | | | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::nv122iyuv | ./.elf | | NV122IYUV | | | | | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::nv122rgba | ./.elf | | NV122RGBA | | | | | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::nv122yuv4 | ./.elf | | NV122YUV4 | | | | | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::nv212iyuv | ./.elf | | NV212IYUV | | | | | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::nv212rgba | ./.elf | | NV212RGBA | | | | | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::nv212yuv4 | ./.elf | | NV212YUV4 | | | | | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::rgba2yuv4 | ./.elf | | RGBA2YUV4 | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::rgba2iyuv | ./.elf | | RGBA2IYUV | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::rgba2nv12 | ./.elf | | RGBA2NV12 | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::rgba2nv21 | ./.elf | | RGBA2NV21 | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::uyvy2iyuv | ./.elf | | UYVY2IYUV | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::uyvy2nv12 | ./.elf | | UYVY2NV12 | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::uyvy2rgba | ./.elf | | UYVY2RGBA | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::yuyv2iyuv | ./.elf | | YUYV2IYUV | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::yuyv2nv12 | ./.elf | | YUYV2NV12 | | | +--------------+---------------------------+--------------------------+ | cvtcolor | xf::cv::yuyv2rgba | ./.elf | | YUYV2RGBA | | | +--------------+---------------------------+--------------------------+ | Demosaicing | xf::cv::demosaicing | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Difference | xf::cv::GaussianBlur, | ./.elf | | | and | | | | xf::cv::subtract | | +--------------+---------------------------+--------------------------+ | Dilation | xf::cv::dilate | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Erosion | xf::cv::erode | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Fast | xf::cv::fast | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Gaussianfilt | xf::cv::GaussianBlur | ./.elf | | er | | | +--------------+---------------------------+--------------------------+ | Gaincontrol | xf::cv::gaincontrol | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Gammacorrec | xf::cv::gammacorrection | ./.elf | | tion | | | +--------------+---------------------------+--------------------------+ | Harris | xf::cv::cornerHarris | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Histogram | xf::cv::calcHist | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Histequializ | xf::cv::equalizeHist | ./.elf | | e | | | +--------------+---------------------------+--------------------------+ | Hog | xf::cv::HOGDescriptor | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Houghlines | xf::cv::HoughLines | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | inRange | xf::cv::inRange | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Integralimg | xf::cv::integralImage | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Lkdensepyrof | xf::cv::densePyrOpticalFlo| ./.elf | | | w | | | | | | +--------------+---------------------------+--------------------------+ | Lknpyroflow | xf::cv::DenseNonPyr | ./.elf | | | LKOpticalFlow | | | | | | +--------------+---------------------------+--------------------------+ | Lut | xf::cv::LUT | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Kalman | xf::cv::KalmanFilter | ./.elf | | Filter | | | +--------------+---------------------------+--------------------------+ | Magnitude | xf::cv::magnitude | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Max | xf::cv::Max | ./.elf | | | | | | | | | +--------------+---------------------------+--------------------------+ | MaxS | xf::cv::MaxS | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | meanshifttra | xf::cv::MeanShift | ./.elf | | cking | | | | | | | +--------------+---------------------------+--------------------------+ | meanstddev | xf::cv::meanStdDev | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | medianblur | xf::cv::medianBlur | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Min | xf::cv::Min | ./.elf | | | | | | | | | +--------------+---------------------------+--------------------------+ | MinS | xf::cv::MinS | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Minmaxloc | xf::cv::minMaxLoc | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | otsuthreshol | xf::cv::OtsuThreshold | ./.elf | | d | | | +--------------+---------------------------+--------------------------+ | paintmask | xf::cv::paintmask | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Phase | xf::cv::phase | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Pyrdown | xf::cv::pyrDown | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | Pyrup | xf::cv::pyrUp | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | reduce | xf::cv::reduce | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | remap | xf::cv::remap | ./.elf | | | | | | | | | | | | | +--------------+---------------------------+--------------------------+ | Resize | xf::cv::resize | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | scharrfilter | xf::cv::Scharr | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | set | xf::cv::set | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | SemiGlobalBM | xf::cv::SemiGlobalBM | ./.elf | | | | | | | | | +--------------+---------------------------+--------------------------+ | sobelfilter | xf::cv::Sobel | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | stereopipeli | xf::cv::StereoPipeline | ./.elf | | ne | | | | | | | +--------------+---------------------------+--------------------------+ | stereolbm | xf::cv::StereoBM | ./.elf | | | | | | | | | +--------------+---------------------------+--------------------------+ | subRS | xf::cv::SubRS | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | subS | xf::cv::SubS | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | sum | xf::cv::sum | ./.elf | | | | | | | | | +--------------+---------------------------+--------------------------+ | Svm | xf::cv::SVM | ./.elf | +--------------+---------------------------+--------------------------+ | threshold | xf::cv::Threshold | ./.elf | | | | | +--------------+---------------------------+--------------------------+ | warptransfor | xf::cv::warpTransform | ./.elf | | m | | | +--------------+---------------------------+--------------------------+ | zero | xf::cv::zero | ./.elf | | | | | +--------------+---------------------------+--------------------------+ .. |image0| image:: ./images/wuz1554997295362.png :class: image .. |image1| image:: ./images/wuz1554997295362.png :class: image .. |image2| image:: ./images/wuz1554997295362.png :class: image