Design Overview


This module shows how to add a 2D convolution filter between the capture pipeline and the display. The 2D filter is implemented purely in software using the OpenCV library.

btrd_dm7_2017.4.jpg



Design Components


This module requires the following components:
  • zcu102_base_trd (SDSoC)
  • filter2d (plugin)
  • video_lib
  • video_qt2



Build Flow Tutorials


2D Filter Sample


This tutorial shows how to build the OpenCV version of the 2D filter sample based on the Base TRD SDSoC platform.

  • Set the SYSROOT environment variable. This requires that you have previously completed the PetaLinux build step.
    Note 1 : Make sure you set the env variable in the same shell that is used to launch SDx. Also make sure the env variable is set before starting SDx, otherwise close and re-start SDx.
    Note 2: The below command assumes you are using the default yocto tmp directory. If you are using a custom yocto tmp directory, you need to modify the path accordingly.
    % export SYSROOT=$TRD_HOME/apu/petalinux_bsp/tmp/sysroots/plnx_aarch64
  • Follow the steps in design module 5 to create a new workspace and to import the video_lib and video_qt2 projects. Otherwise, open the existing SDx workspace.
    % cd $TRD_HOME/apu/video_app
    % sdx -workspace . &
  • Import the filter2d plugin project by clicking 'File -> Import -> General -> Existing Project into Workspace'. Check the filter2d project and click 'Finish'
    dm7_filter2d_plugin_2017.4.jpg
  • Right-click the filter2d project and select 'C/C++ Build Settings -> Settings -> Symbols'. Remove the WITH_SDSOC symbol by clicking the red X icon. Confirm with 'OK'.
    dm7_filter2d_wsdsoc_2017.4.jpg
  • Right-click the filter2d project and select 'Build Project'.
    base-trd-2016-3-dm7-sdx-filter2d-build.png

Video Qt Application


This tutorial shows how to build the video library and the video Qt application.

  • Make sure the video_lib project has the WITH_SDSOC symbol removed from the C/C++ settings (see DM5 for instructions).
  • Source the Qt setup script and generate the Qt Makefile.
    % cd $TRD_HOME/apu/video_app/video_qt2
    % source qmake_set_env.sh
    % qmake video_qt2-dm7.pro -r -spec linux-oe-g++
  • Close SDx and reopen the same workspace so the Qt environment gets picked up correctly by eclipse. If you have sourced the qmake_set_env.sh script in the same shell before opening SDx, you can skip this step.
  • Right-click the video_qt2 project and click 'Build Project'.
    base-trd-2016-3-dm5-video-qt-build.png
  • Copy the generated video_qt2 executable to the dm7 SD card directory. Copy the Linux image and boot image from DM6 (see previous tutorial for build instructions).
    % mkdir -p $TRD_HOME/images/dm7
    % cp video_qt2 $TRD_HOME/images/dm7/
    % cp $TRD_HOME/images/dm6/BOOT.BIN $TRD_HOME/images/dm6/image.ub $TRD_HOME/images/dm7



Run Flow Tutorial


  • See here for board setup instructions.
  • Copy all the files from the $TRD_HOME/images/dm7 SD card directory to a FAT formatted SD card.
  • Power on the board to boot the images; make sure INIT_B, done and all power rail LEDs are lit green.
  • After ~30 seconds, the display will turn on and the application will start automatically, targeting the max supported resolution of the monitor (one of 3840x2160 or 1920x1080 or 1280x720). The application will detect whether DP Tx or HDMI Tx is connected and output on the corresponding display device.
  • To re-start the TRD application with the max supported resolution, run
    % run_video.sh
  • To re-start the TRD application with a specific supported resolution use the -r switch e.g. for 1920x1080, run
    % run_video.sh -r 1920x1080
  • The user can now control the application from the GUI's control bar (bottom) displayed on the monitor.
  • The user can select from the following video source options:
    • TPG (SW): virtual video device that emulates a USB webcam purely in software
    • USB: USB Webcam using the universal video class (UVC) driver
    • TPG (PL): Test Pattern Generator implemented in the PL
    • HDMI: HDMI input implemented in the PL
  • The user can select from the following accelerator options:
    • Passthrough (no accelerator)
    • 2D convolution filter with configurable coefficients
  • A 2D convolution filter can be turned on and different filter presets can be selected; the following filter modes are available:
    • SW - accelerator is run on A53 using OpenCV implementation
    dm7_2017.4.jpg
  • The video info panel (top left) shows essential settings/statistics.
  • The CPU utilization graph (top right) shows CPU load for each of the four A53 cores.



Return to the Design Tutorials Overview.