GasLeakDetector C++ lib. Fast library to emphasize motion on video for gas leak detection and motion magnification

€4,000.00

GasLeakDetector C++ library for amplification subtle motion and temporal variations in digital video content.

LICENSE: We sell source code of this library as is, without future updates and technical support according to perpetual non-exclusive 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.

GasLeakDetector C++ library for amplification subtle motion and temporal variations in digital video content.

LICENSE: We sell source code of this library as is, without future updates and technical support according to perpetual non-exclusive 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

GasLeakDetector C++ library amplifies subtle motion and temporal variations in digital video content. The library implements a video filtering function and can be used not only for Gas Leak Detection but for motion magnification in general. The library is implemented in C++ (C++17 standard). This library is suitable for various types of cameras (daylight, SWIR, MWIR and LWIR). Each instance of the GasLeakDetector C++ class object performs frame-by-frame processing of a video data stream, processing each video frame independently in only one thread (one CPU core used). The library is only intended for stationary (or slowly moving) cameras or for PTZ cameras when observing a certain sector. The algorithm works on a single CPU core. The library depends on the open-source VFilter library (provides interface as well as defines data structures for various video filter implementations, source code included, Apache 2.0 license). Additionally, the demo application and example depend on the open-source SimpleFileDialog (provides dialog to open files, source code included, Apache 2.0 license) and OpenCV (provides user interface, version >= 4.5, linked, Apache 2.0 license).

Downloads

Documentation: GO TO DOCUMENTATION

Demo application to check algorithms performance on your video (Windows x64): DOWNLOAD

Demo video

Simple interface

namespace cr
{
namespace video
{
/**
 * @brief Gas leak detector class. Implements Eulerian video motion
 * magnification to detect subtle intensity changes.
 */
class GasLeakDetector : public VFilter
{
public:

    /** @brief Constructor. Creates GasLeakDetector object. */
    GasLeakDetector();

    /** @brief Destructor. Destroys GasLeakDetector object. */
    ~GasLeakDetector();

    /** @brief Get string of current library version. */
    static std::string getVersion();

    /** @brief Initialize detector with given parameters. */
    bool initVFilter(VFilterParams& params) override;

    /** @brief Set detector parameter. */
    bool setParam(VFilterParam id, float value) override;

    /** @brief Get detector parameter value. */
    float getParam(VFilterParam id) override;

    /** @brief Get all detector parameters. */
    void getParams(VFilterParams& params) override;

    /** @brief Execute action command. */
    bool executeCommand(VFilterCommand id) override;

    /** @brief Process frame. */
    bool processFrame(cr::video::Frame& frame) override;

    /** @brief Set detector mask. */
    bool setMask(cr::video::Frame mask) override;

    /** @brief Decode and execute command from serialized data. */
    bool decodeAndExecuteCommand(uint8_t* data, int size) override;
};
}
}

Simple example

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

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

    // Create frames.
    cv::Mat bgrImg;
    int width = (int)videoSource.get(cv::CAP_PROP_FRAME_WIDTH);
    int height = (int)videoSource.get(cv::CAP_PROP_FRAME_HEIGHT);
    cr::video::Frame frameYuv(width, height, cr::video::Fourcc::YUV24);

    // Create gas leak detector and set initial params.
    cr::video::GasLeakDetector filter;
    filter.setParam(cr::video::VFilterParam::MODE, 1); // Enable.
    filter.setParam(cr::video::VFilterParam::LEVEL, 50); // 50% level.

    // Main loop.
    while (true)
    {
        // Capture next video frame. Default BGR pixel format.
        videoSource >> bgrImg;
        if (bgrImg.empty())
        {
            // Set initial video position to replay.
            videoSource.set(cv::CAP_PROP_POS_FRAMES, 0);
            continue;
        }

        // Convert BGR to YUV for filter.
        cv::Mat yuvImg(height, width, CV_8UC3, frameYuv.data);
        cv::cvtColor(bgrImg, yuvImg, cv::COLOR_BGR2YUV);

        // Magnify movement with default params.
        filter.processFrame(frameYuv);

        // Convert result YUV to BGR to display.
        cv::cvtColor(yuvImg, bgrImg, cv::COLOR_YUV2BGR);

        // Show video.
        cv::imshow("VIDEO", bgrImg);
        if (cv::waitKey(1) == 27)
            return 0;
    }
    return 1;
}