Examples of three LinkSVP: OpenCV achieved using an image binarization
background
In order to facilitate customers to do the application of AI, Hass chip provides HiSVP
, HiIVE
such 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 SDK
development 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 HiIVE
can accelerate the development of intelligent analysis of intelligence analysis program to reduce CPU
occupancy. The current HiIVE
offer operators can support the development of video diagnostics, perimeter guard and other intelligent analysis program.
HiSVP
Development framework as shown below:
LinkSVP Profile
LinkSVP
(Smart Vision Platform) integrated Hass HiSVP
, HiIVE
, NCNN
, OpenCV
and so on, the future will support tensorflow
. LinkSVP
Based LinkLib
, therefore, with the LinkLib
convenience, developers do not need to deal with the underlying video transmission, can be more focused on the design and optimization algorithms. Developers based on LinkFrame
object 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.
LinkSVP
Development framework as shown below:
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/demo
directory - Run
UseOpencv
the program
operation result
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();
}