Skip to content

blablabliam/ZapCapture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZapCapture

A computer vision program to extract lightning strikes! ⚡

Contributors Forks Stargazers MIT License


Lightning Strikes!

ZapCapture

A python program that extracts lightning images/gifs from videos of storms! ⚡

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.

After showing off my cool pictures, people expressed serious interest in running the software themselves. This wraps the project in a GUI and make it easy enough for stormchasers and tinkerers to use, while adding additional features like mp4 output support and a progress visual.

Now I have tested the program with hours upon hours of footage, detecting lightning, red sprites, and ELVES from storm footage provided by others and myself. Please enjoy this program, and if you get good lightning strikes, please share them with me!

Built With

Roadmap

V0 ✔️ (See Independent Repository)

  • Script in a Jupyter Notebook. ✔️

V1 ✔️

  • Implement a working GUI that is OS independent. ✔️

V2 ✔️

  • Quality of Life Features & Bug Testing
  • requirements.txt ✔️
  • Graphics overhaul for less ugly interface ✔️
  • Multi-threading for faster processing ✔️
  • Progress bar ✔️
  • Error handling to give feedback during analysis ✔️
  • Saved file frame/timestamp option ✔️
  • Detection dead-zone ✔️
  • MP4 output mode for cool multi-frame lightning ✔️
  • Fix crash after analysis ✔️
  • Windows Installation ✔️

Future Features

These features may or may not be written in the future, depending on interest in the program and my ability to keep working on it.

  • Red Sprite mode.
  • I have acquired some test footage (thanks to Stephen C Hummel for submitting extensive footage!) for this feature, so this is the next anticipated feature. It will specifically detect and extract red sprites, useful for research and photography. Currently, ZapCapture WILL detect sprites, but only when also detecting lightning. This fills up the output file list and is only marginally better than going through the video manually.
  • Automatic Threshold Setting
  • Analyze a short section of video, automatically determine an appropriate threshold, and apply to the video. Repeat for each video, to prevent unique video settings like time of day from affecting the result. This will cause analysis to take longer, but it should improve the user experience and result in more accurate detection given a variety of videos.
  • Live View During Processing
  • Having a live view of the video, or at least a way to see the gif outputs, would improve user feedback during processing. At the moment, if the progress bar is moving slowly, there is no way to tell if ZapCapture has frozen or is working. Seeing images and gifs populate a field would fix this lack of feedback, and give a fast sense of the image quality/strike frequency while running.

Design

ZapCapture takes a folder full of videos and uses OpenCV to detect differences between footage frames. If the difference exceeds a user-defined threshold, then the image is saved as a PNG. You can tune the detection threshold to suit your individual video; on a ten minute video, ZapCapture can extract less than a hundred frames or several thousand, depending on the threshold. Sequences of frames will also be saved as gif files, so that you can watch strikes happen in slow-motion.

GUI design

Instructions

Windows 10

Download the windows installer and follow the instructions to install.

Uninstall ZapCapture through the Windows Application Manager as you would any other application.

Linux

Instructions for Linux coming soon.

Processing

  1. Use the input and output folder buttons to select a folder with lightning videos and an empty folder.
  2. Set an appropriate threshold for your videos. 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. The default threshold is too high for almost any detections to occur, so you will need to delete a 0 or two for the best results. If you are having trouble, check the csv outputs and pick a threshold value that is higher than the typical detection value.
  3. Select a file name convention- frame number or timestamp (seconds-milliseconds format).
  4. Finally, click 'Analyze!' and wait a bit. The program will take a few minutes to run. Once analysis is finished, your output folder will contain all of the image and mp4 files, as well as a csv giving threshold data for each frame on every file.

Building

Interested in building ZapCapture on your system? To build ZapCapture, you need to have Python 3.6 or later. Clone this repository, and use pip to install the requirements.txt file.

$ python -m pip install -r requirements.txt

Run LightningGUI.py to analyze some lightning!

If you would like to run from an executable instead of python, use pyinstaller.

$ cd Downloads/Lightning-Analyzer-GUI

$ pyinstaller LightningGUI.py --onefile --icon logo.ico

If you don't want to see debugging info, add --noconsole to the pyinstaller command. Now, you will find a folder called dist with an executable inside!

License

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

Contact

Liam Plybon - [email protected] - www.blablabliam.github.io

Project Link: https://github.com/blablabliam/ZapCapture

Like it enough to spend money? Don't feel pressured.

Buy Me A Hammer

Acknowledgments

About

GUI-Based Lightning Frame Extractor for Stormchasers and Photographers. ⚡

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages