change detection in two frames of a video

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
IRDump
Posts: 2
Joined: 2018-03-06T22:35:20-07:00
Authentication code: 1152

change detection in two frames of a video

Post by IRDump »

hello everyone,
we have two frames of a video which has been take from a target shoot paper. Our goal is to detect new bullet holes from these frames.
i have uploaded my samples and you can download it from here -> "http://s9.picofile.com/file/8321113492/ ... e.rar.html" or from https://ufile.io/yc4ri.
Any suggestion is very helpful and i'm waiting for your contribution.
best regards
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: change detection in two frames of a video

Post by fmw42 »

If your two images are perfectly aligned, then see

https://www.imagemagick.org/Usage/compose/#difference
https://www.imagemagick.org/script/compare.php
https://www.imagemagick.org/Usage/compare/

For example, try

Code: Select all

convert "Video (7)19.jpg" "Video (7)20.jpg" -compose difference -composite -auto-level -negate -threshold 10% -negate result.png
IRDump
Posts: 2
Joined: 2018-03-06T22:35:20-07:00
Authentication code: 1152

Re: change detection in two frames of a video

Post by IRDump »

dear "fmw42",
thank you very much for your valuable solution. Is there any way to calculate threshold value dynamically at run time? how can we distinguish real bullet holes from noises in very short processing time which exists between two frames?
best regards
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: change detection in two frames of a video

Post by fmw42 »

Your images have such low resolution that the bullet holes are tiny. I would not know how to distinguish those from significant noise. If the bullet holes are large enough, you can use -connected-components to filter out all regions that are too small.

As to the threshold, I am not sure there is a good way to do that automatically. But perhaps you can find some value that reasonable in combination with -connected-components.

See http://magick.imagemagick.org/script/co ... onents.php
Post Reply