On July 23, 2019, the most spectacular lightning storm that I've ever seen rolled through Spokane. I managed to capture 15 minutes' worth of video. Rather than pick out the most striking stills manually, I took the opportunity to acquaint myself with OpenCV, and wrote some code that automatically extracts frames whose brightness exceeds a given threshold. (Well, more precisely, it extracts a frame if the proportion of the frame's pixels that fall within prescribed regional and brightness bounds exceeds a given threshold.)
For the 10-second, potentially seizure-inducing result of this endeavor, check out data/flashes.mp4
. ⚡
matplotlib
(but only for theshow_histogram
function)opencv-python
- OpenCV: Histograms - 1 : Find, Plot, Analyze !!! : The tutorial that brought me up to speed.
- Reading and Writing Images and Video
cv2.cvtColor
: Documentation for the method that I used to convert color images to grayscale ones.