I’ve got a cctv footage of bike robbery , video is not clear. I’m working on enhancing the video to find details about the vehicles or face or any other information from it.
https://drive.google.com/file/d/0B8ZjiDWHZ1j-QkVKZFV4ZkV1ODA/view?usp=sharing
original
histogram equalised
CLAHE
What I've done till now in python opencv
- Basic histogram equalisation because its a night time footage.
- Since there were bright hotspots in the film, I applied contrast limited adaptive hist equalization (CLAHE) and experimented with cliplimit 1 to 10 and grid sizes from 4 to 32.
- I've been playing with gabor filter to reduce the headlamp flash of the bikes but not able to tune it to the right parameters.
- Since there is some noise in the video , thought of denoising it with fastNlDenoising but with no results.
- Since image is small I tried super resolution of the image using SeRanet SeRanet on github.But its very slow to run on even a single image and results were not good enough to verify the face in the video. (at least on the frame I ran SeRanet over).
Any help on how can i proceed to gather more information from the video (or is it dead end by some limitations)
import numpy as np
import cv2
import time
cap = cv2.VideoCapture('./bike_robbery.mp4')
clahe = cv2.createCLAHE(clipLimit=3.0, tileGridSize=(32,32))
count=0
sig = 1
th = 0
lm = 1.0
gm = 0.02
ps = 0;
ksize =31
gaborKernel=cv2.getGaborKernel((ksize,ksize), sig, th, lm, gm, ps);
sleeptime=0.001
while(cap.isOpened()):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cl1 = clahe.apply(gray)
equ = cv2.equalizeHist(gray)
#denoise=cv2.fastNlMeansDenoising(cl1,None,3,90,2)
ths=cv2.threshold(equ, 230, 255, cv2.THRESH_BINARY)[1]
gab=cv2.filter2D(cl1,0 , cv2.CV_32F, gaborKernel);
kernel = np.array([[-1,-1,-1], [-1,18,-1], [-1,-1,-1]])
im = cv2.filter2D(equ, -1, kernel)
res = np.hstack((gray,equ,cl1)) #stacking images side-by-side
cv2.imwrite("./clahe_pics/frame%d.jpg" % count, cl1)
cv2.imwrite("./hist_pics/frame%d.jpg" % count, equ)
count = count + 1
cv2.imshow('frame',res)
time.sleep(sleeptime)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
if cv2.waitKey(1) & 0xFF == ord('s'):
sleeptime+=0.05
if cv2.waitKey(1) & 0xFF == ord('f'):
sleeptime-=.05
cap.release()
cv2.destroyAllWindows()