MotionMagnificator C++ lib. Fast library to emphasize motion on video for moving object visibility enhancement

€4,000.00

MotionMagnificator 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.

MotionMagnificator 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

MotionMagnificator C++ library computes the amplitude of the motion of every pixel of digital video frames and gives it as a separate grayscale image or shows it in the intensity channel of the frames, so that motion which is not visible to the naked eye in the original video becomes visible. When the intensity channel shows the motion, the colour channels of the frames can show the original intensity of the scene with a palette (Arctic, Ironbow or Rainbow), so that the scene of cameras without colour (for example thermal cameras) stays recognisable; the colours do not depend on the motion. The library is implemented in C++ (C++17 standard) and uses OpenMP (version >= 2.0) for multithreading if it is available on the particular platform. The library is suitable for various types of cameras (daylight, SWIR, MWIR and LWIR). Each instance of the MotionMagnificator C++ class performs frame-by-frame processing of one video stream. The library is intended for fixed (or slowly moving) cameras and for PTZ cameras while pan, tilt and zoom do not change. It works on different platforms: it detects at build time whether OpenMP is available (without OpenMP the processing runs on one CPU core, with OpenMP the user chooses the number of threads) and selects at run time the SIMD instructions (AVX2, SSSE3, NEON) the processor supports.

Downloads

Documentation: GO TO DOCUMENTATION

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

Demo video

Simple interface

class MotionMagnificator : public VFilter
{
public:

    /// Class constructor: mode on, type 0, level 40, one thread, no palette.
    MotionMagnificator();

    /// Class destructor.
    ~MotionMagnificator() override;

    /// The class cannot be copied or moved.
    MotionMagnificator(MotionMagnificator const&) = delete;
    MotionMagnificator& operator=(MotionMagnificator const&) = delete;
    MotionMagnificator(MotionMagnificator&&) = delete;
    MotionMagnificator& operator=(MotionMagnificator&&) = delete;

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

    /// Initialize motion magnificator.
    bool initVFilter(VFilterParams& params) override;

    /// Set motion magnificator parameter.
    bool setParam(VFilterParam id, float value) override;

    /// Get motion magnificator parameter value.
    float getParam(VFilterParam id) override;

    /// Get all motion magnificator parameters.
    void getParams(VFilterParams& params) override;

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

    /// Process frame.
    bool processFrame(rapidpixel::Frame& frame) override;

    /// Get the amplitudes of the last processed frame (not part of VFilter).
    bool getAmplitudes(rapidpixel::Frame& amplitudes);

    /// Set mask.
    bool setMask(rapidpixel::Frame mask) override;

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

Simple example

#include <iostream>
#include <string>
#include "MotionMagnificator.h"
#include "SimpleUi.h"
#include "VSourceFile.h"

// Link namespaces.
using namespace std;
using namespace rapidpixel;

int main()
{
    // Open the video file. The file replays itself at its end.
    VSourceFile videoSource;
    string fileName{"test.mp4"};
    if (!videoSource.openVSource(fileName))
        return 1;

    // Source frame. Request for YUV24.
    Frame frame;
    frame.fourcc = Fourcc::YUV24;

    // Init MotionMagnificator and set params.
    MotionMagnificator filter;
    filter.setParam(VFilterParam::MODE, 1); // Enable filtering.
    filter.setParam(VFilterParam::CUSTOM_1, 2); // Number of threads.
    filter.setParam(VFilterParam::LEVEL, 100); // Max level.
    filter.setParam(VFilterParam::TYPE, 1); // Enable effect in video.

    // Create windows to display frame.
    rapidpixel::SimpleUiWindow window{"VIDEO"};
    window.show();

    // Main loop until the window is closed or ESC is pressed.
    while (window.isOpen())
    {
        // Get next frame.
        if (!videoSource.getFrame(frame, 1000))
            continue;

        // Process the frame: the library changes only the frames given to
        // processFrame(). With TYPE 1 the intensity channel shows the motion.
        if (!filter.processFrame(frame))
            cout << "Frame not processed" << endl;

        // Display the frame in the window.
        window.render(frame);

        // Process keyboard events.
        if (window.getKey(1) == 27)
            break;
    }

    return 0;
}