Skip to content

A computer vision program to extract lightning strikes! ⚡

License

Notifications You must be signed in to change notification settings

blablabliam/Lightning-Analyzer

Repository files navigation

Lightning Analyzer

A computer vision program to extract lightning strikes! ⚡

Contributors Forks Stargazers MIT License


Lightning Strikes!

Lightning Key Frame Extraction Notebook

A Jupyter Notebook that extracts lightning images from videos of storms! :lightning:

Table of Contents

  1. About The Project
  2. Design
  3. Instructions
  4. License
  5. Contact
  6. Acknowledgments

About The Project

Sometimes I like to set up my camera during storms, but watching hours of footage after a lightning storm is time consuming and not very fun. I went to find an existing script to perform this task, and found one written in Python 2 by programmer and mad scientist Saulius Lukse. I converted the handy script to Python 3, and fit the whole thing into a Jupyter notebook for easy access.

Built With

Design

Currently, the notebook takes a video and uses OpenCV to extract frames and dectect a difference between frames. If the difference exedes the threshold, then the image passes and is saved as a jpg. You can tune the threshold to suit your individual video; on a ten minute video, this program can extract less than a hundred frames or several thousand, depending on the threshold.

Future design should be a standalone program, so that stormchasers don't have to wrangle with software as much.

Instructions

First, create a new environment in Anaconda and activate it. Install libopencv, opencv, py-opencv, and pillow to the new enviroment.

Next, create a folder with a lightning video inside; this folder will be filled with images by the lightning frame extractor.

Then, open the lightning extractor notebook. Set the filename to match your lightning video filename; on Linux,

filename = '/home/user/Videos/Camera/lightning.mp4'

Finally, set an appropriate threshold for your video. On the example video, the optimum threshold is around 500,000; the higher the threshold, the faster the process will run and the less output images you will get. You will have to experiment to find the best threshold, but starting high and going lower is the best approach. Once the threshold is set, run the notebook and wait a bit. The program will take a few minutes to run.

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Liam Plybon - [email protected]

Project Link: https://github.com/blablabliam/Lightning-Analyzer

Acknowledgments

About

A computer vision program to extract lightning strikes! ⚡

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published