Skip to content

Detects lightning from video files & saves the frames for review.

License

Notifications You must be signed in to change notification settings

phoughton/lightning_detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lightning_detector

Detects lightning from video files, and saves frames that contain the lightning.

With the write video you can capture images like these:

The ffmpeg_avicon script will attempt to convert your video into something the python script can work with.

You will have to install ffmpeg, and the ffmpeg script assumes linux/*nix or use the docker image in this repository.

It captures at and after a change in mean brightness greater than the threshold value.

That threshold value might change in different conditions, I've found between 2 and 5 (percent) work OK for a cloudy London thunderstorm.

Convert your MP4 file to AVI format:

chmod a+x ffmpeg_avicon
./ffmpeg_avicon VID_20230826_1234.mp4

That will produce a file named .avi

How to use the capture script:

# To run the code:
python lightning.py --threshold 3 VID_20230826_1234.mp4.avi

# To see options:
python lightning.py -h

Issues:

  1. Can produce false positives, as it captures batches after a trigger is detected
  2. Prolonged strikes may be missed, as it uses a rolling mean.
  3. Often requires cropping to isolate lightning

Potential solutions:

  1. False Positives: Isolate only valid frames, by using a Classifier on each frame
  2. Long Strikes missed/truncated: Isolate only valid frames, by using a Classifier on each frame
  3. Often requires cropping: Use a segnmentation model, and use co-ordinates to crop automatically

About

Detects lightning from video files & saves the frames for review.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published