DnnOpenVinoDetector C++ lib. Objects detection based on Intel OpenVino API

€1,500.00

DnnOpenVinoDetector C++ library for automatic detection of objects on videos through the utilization of neural networks.

LICENSE: We sell source code of this library as is, without future updates and technical support according to perpetual non-exclusive royalty-free license. You pay once and can use this library in your software and hardware products without limits. Please read the license agreement before purchasing: LICENSE.

DnnOpenVinoDetector C++ library for automatic detection of objects on videos through the utilization of neural networks.

LICENSE: We sell source code of this library as is, without future updates and technical support according to perpetual non-exclusive royalty-free license. You pay once and can use this library in your software and hardware products without limits. Please read the license agreement before purchasing: LICENSE.

Overview

Dehazer C++ library implements video defog / dehaze algorithm based on histogram manipulations. The library utilizes different histogram manipulations to improve the contrast of the video frame and to reduce the effect of haze. The library is implemented in C++ (C++17 standard) and exclusively relies on OpenCV library (version 4.5.0 and higher). This library is suitable for various types of camera (daylight, SWIR, MWIR and LWIR) and it provides simple programming interface. Each instance of the Dehazer C++ class object performs frame-by-frame processing of a video data stream, processing each video frame independently. The library depends on open source VFilter library (provides interface as well as defines data structures for various video filters implementation, source code included, Apache 2.0 license) and OpenCV library (version >=4.5.0, linked, Apache 2.0 license). Additionally demo application depends on open source SimpleFileDialog (provides dialog to open files, source code included, Apache 2.0 license).

Documentation

Documentation: GO TO DOCUMENTATION

Simple interface

class DnnOpenVinoDetector : public ObjectDetector
{
public:
    /// Get string of current library version.
    static std::string getVersion();
    
    /// Init object detector.
    bool initObjectDetector(ObjectDetectorParams& params) override;
    
    /// Set object detector param.
    bool setParam(ObjectDetectorParam id, float value) override;
    
    /// Get object detector param value.
    float getParam(ObjectDetectorParam id) override;
    
    /// Get object detector params structure.
    void getParams(ObjectDetectorParams& params) override;
    
    /// Get list of objects.
    std::vector<Object> getObjects() override;
    
    /// Execute command.
    bool executeCommand(ObjectDetectorCommand id) override;
    
    /// Perform detection.
    bool detect(cr::video::Frame& frame) override;
    
    /// Set detection mask.
    bool setMask(cr::video::Frame mask) override;
    
    /// Decode command and execute command.
    bool decodeAndExecuteCommand(uint8_t* data, int size) override;
}

Simple example

#include <opencv2/opencv.hpp>
#include "DnnOpenVinoDetector.h"

int main(void)
{
    // Open video file "test.mp4".
    cv::VideoCapture videoSource;
    if (!videoSource.open("test.mp4"))
        return -1;

    // Create and init detector.
    cr::detector::DnnOpenVinoDetector detector;
    cr::detector::ObjectDetectorParams params;
    params.initString = "./yolov7s.onnx;640;640";
    params.maxObjectHeight = 96;
    params.maxObjectWidth = 96;
    params.minObjectHeight = 4;
    params.minObjectHeight = 4;
    params.type = 1;
    detector.initObjectDetector(params);

    // Create frames.
    cv::Mat frameBgrOpenCv;

    // Main loop.
    while (true) {
        // Capture next video frame.
        videoSource >> frameBgrOpenCv;
        if (frameBgrOpenCv.empty()) {
            // If we have video file we can set initial position to replay.
            detector.executeCommand(cr::detector::ObjectDetectorCommand::RESET);
            videoSource.set(cv::CAP_PROP_POS_FRAMES, 0);
            continue;
        }

        // Copy frame data from OpenCv frame to Frame.
        cr::video::Frame frameBgr;
        frameBgr.fourcc = cr::video::Fourcc::BGR24;
        frameBgr.width = frameBgrOpenCv.size().width;
        frameBgr.height = frameBgrOpenCv.size().height;
        frameBgr.size = frameBgr.width * frameBgr.height * 3;
        frameBgr.data = frameBgrOpenCv.data;

        // Detect objects.
        detector.detect(frameBgr);

        // Get list of objects.
        std::vector<cr::detector::Object> objects = detector.getObjects();

        // Draw detected objects.
        for (int n = 0; n < objects.size(); ++n) {
            rectangle(frameBgrOpenCv, cv::Rect(objects[n].x, objects[n].y,
                      objects[n].width, objects[n].height),
                      cv::Scalar(0, 0, 255), 1);
            putText(frameBgrOpenCv, std::to_string(objects[n].p),
                    cv::Point(objects[n].x, objects[n].y),
                    1, 1, cv::Scalar(0, 0, 255));
        }

        // Show video.
        cv::imshow("VIDEO", frameBgrOpenCv);
        // Wait ESC.
        if (cv::waitKey(1) == 27)
            return -1;
    }
    return 1;
}