ermig1979 / Simd

C++ image processing and machine learning library with using of SIMD: SSE, AVX, AVX-512, AMX for x86/x64, NEON for ARM.
http://ermig1979.github.io/Simd
MIT License
2.06k stars 412 forks source link

How to detect small fast moving object with motion detector ? #138

Closed trlsmax closed 3 years ago

trlsmax commented 3 years ago

I try to use motion detector to detect shooting star in video with the example code UseMotionDetector.cpp. But nothing was detected. Is the motion detctor suit for this job or do i need to tune some parameters ? Thanks

ermig1979 commented 3 years ago

You can configure motion detector before using:

        Detector detector;

        Model model;
        model.size = Size(0.1, 0.1); // Sets minimal size of object to detect. ONVIF size is restricted by range [0, 2].
        detector.SetModel(model);

        Options options;
        options.TrackingAdditionalLinking = 0; // Sets coefficient to boost trajectory linking. By default it is equal to 0.
        options.ClassificationShiftMin = 0.075; // Sets minimal shift (in screen diagonals) of motion region to detect object. By default it is equal to 0.075.
        options.ClassificationTimeMin = 1.0; // Sets minimal life time(in seconds) of motion region to detect object. By default it is equal to 1 second.
        detector.SetOptions(options);

In your case it is reasonable to try to decrease model.size, options.ClassificationShiftMin, options.ClassificationTimeMin and increase options.TrackingAdditionalLinking.

trlsmax commented 3 years ago

No matter how I change the parameters, it just can't detect any object. Here is a sample video: http://sonotaco.jp/HDsamples/M20130101_055312_TK1_H2.wmv

I tried something like these:

        Detector detector;

        Model model;
        model.size = Size(0.001, 0.001); // Sets minimal size of object to detect. ONVIF size is restricted by range [0, 2].
        detector.SetModel(model);

        Options options;
        options.TrackingAdditionalLinking = 0.5; // Sets coefficient to boost trajectory linking. By default it is equal to 0.
        options.ClassificationShiftMin = 0.0005; // Sets minimal shift (in screen diagonals) of motion region to detect object. By default it is equal to 0.075.
        options.ClassificationTimeMin = 0.0005; // Sets minimal life time(in seconds) of motion region to detect object. By default it is equal to 1 second.
        detector.SetOptions(options);

But thank you for the reply.

ermig1979 commented 3 years ago

I have tried to set following options:

Model model;
model.size = FSize(0.01, 0.01); // Sets minimal size of object to detect. ONVIF size is restricted by range [0, 2].
detector.SetModel(model);

Options options;
options.DifferenceDxFeatureWeight = 0;
options.DifferenceDyFeatureWeight = 0;
options.TrackingAdditionalLinking = 5; // Sets coefficient to boost trajectory linking. By default it is equal to 0.
options.ClassificationShiftMin = 0.01; // Sets minimal shift (in screen diagonals) of motion region to detect object. By default it is equal to 0.075.
options.ClassificationTimeMin = 0.01; // Sets minimal life time(in seconds) of motion region to detect object. By default it is equal to 1 second.
detector.SetOptions(options);

And it works!

trlsmax commented 3 years ago

Yes, it works ! Thank you very much.