Skip to content

Instantly share code, notes, and snippets.

@aravindpai
Created March 30, 2020 13:38
Show Gist options
  • Save aravindpai/aa5b5059ad380326dc0f1aa75999b129 to your computer and use it in GitHub Desktop.
Save aravindpai/aa5b5059ad380326dc0f1aa75999b129 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import cv2
import numpy as np
import os
import re
#listing down all the file names
frames = os.listdir('frames/')
frames.sort(key=lambda f: int(re.sub('\D', '', f)))
#reading frames
images=[]
for i in frames:
img = cv2.imread('frames/'+i)
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img = cv2.GaussianBlur(img,(25,25),0)
images.append(img)
images=np.array(images)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment