Examples of three LinkSVP: the machine vision based presentation, using the binarized image to achieve OpenCV

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_45326556/article/details/99934555

background

    In order to facilitate customers to do the application of AI, Hass chip provides HiSVP, HiIVEsuch as engines. HiSVP(HiSilicon Smart Vision Platform) is the Hass visual media processing chip smart accelerate heterogeneous platforms. The platform includes CPU, , DSP(NeuralNNIE Network Inference Engine) and other hardware processing unit and runs on hardware SDKdevelopment environment, as well as supporting the development tool chain environment. HiIVE(HiSilicon Intelligent Video Engine) is Hass media processing chip intelligent analysis system for hardware acceleration module. Based on user HiIVEcan accelerate the development of intelligent analysis of intelligence analysis program to reduce CPUoccupancy. The current HiIVEoffer operators can support the development of video diagnostics, perimeter guard and other intelligent analysis program.
    HiSVPDevelopment framework as shown below:
Here Insert Picture Description

LinkSVP Profile

    LinkSVP(Smart Vision Platform) integrated Hass HiSVP, HiIVE, NCNN, OpenCVand so on, the future will support tensorflow. LinkSVPBased LinkLib, therefore, with the LinkLibconvenience, developers do not need to deal with the underlying video transmission, can be more focused on the design and optimization algorithms. Developers based on LinkFrameobject class created only need to set goals algorithm required resolution, frame rate, the system automatically handles low-level video interface, developers need only call its algorithm to arrive when the video frame.
    With the integration of NCNN, even on unsupported NNIE chips, but also the depth of learning simple arithmetic.
    LinkSVPDevelopment framework as shown below:
Here Insert Picture Description

UseOpencv exemplary image binarization

The sample program demonstrates how to use opencv image binarization operation
when the function when the IVE system can not meet the demand, we can achieve with a strong opencv, but please observe the cpu performance.

Ready to work

  • Refer to the user manual setup the development environment, compiler 3531D engineering, network boot configuration parameters.
  • With HDMI output device (e.g. camera, a notebook, a set top box, etc.) access the HDMI-A Evaluation Board Interface
  • The evaluation board monitor connected HDMI-OUT (1080P can support, default program output 1080P60).
  • On power-up, enter the /root/demodirectory
  • Run UseOpencvthe program

operation result

Here Insert Picture Description

Complete project

See the complete project: https://gitee.com/LinkPi/LinkSVP/tree/master/UseOpencv

The main source code

main.cpp

#include <QCoreApplication>
#include "Link.h"
#include "Sample.h"

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    Link::init();

    LinkObject *vi=Link::create("InputVi");
    QVariantMap dataVi;
    dataVi["interface"]="HDMI-A";
    vi->start(dataVi);

    Sample *SP=new Sample();
    SP->start();

    LinkObject *vo=Link::create("OutputVo");
    QVariantMap dataVo;
    dataVo["type"]="hdmi";
    vo->start(dataVo);

    vi->linkV(SP)->linkV(vo);

    return a.exec();
}

Sample.cpp

#include "Sample.h"

Sample::Sample(QObject *parent) : LinkFrame(parent)
{
    data["framerate"]=10;
    data["width"]=1280;
    data["height"]=720;

    //建议使用如下方法把内存映射到cache再进行CPU操作,否则速度很慢
    mem["cache"]=IVEMem(1280,720,3,true);
}

void Sample::oneFrame()
{
    copy(mem["in"],mem["cache"]);
    wait();

    Mat mat=Mat(data["height"].toInt(), data["width"].toInt(), CV_8UC1, (void*)mem["cache"].data());

    threshold(mat, mat, 128, 255, CV_THRESH_BINARY);

    mem["cache"].flush();
    copy(mem["cache"],mem["out"]);
    wait();
}

Guess you like

Origin blog.csdn.net/weixin_45326556/article/details/99934555