Controlling VLC player
using hand gestures
By
[Link] Varma
[Link]
[Link] Khan
[Link] Kasyap
TensorFlow
Modules
OpenCV
Tensorflow
➢ TensorFlow is a free and open-source software library for machine learning and
artificial intelligence.
➢ It can be used across a range of tasks but has a
particular focus on training and inference of
deep neural networks.
➢ TensorFlow is a symbolic math library based on dataflow
and differentiable programming
OpenCV
➢ OpenCV is a library of programming functions mainly
aimed at real-time computer vision.
➢ It mainly focuses on image processing, video capture
and analysis including features like face detection
and object detection.
CNN kernal
➢ In Convolutional Neural Network, the kernel is nothing but a filter that is used to extract the
Features from the images.
➢ The kernel is a matrix that moves over the input data, performs the dot product with the
sub-region of input data, and gets the output as the matrix of dot products.
CNN kernel for Vedio capture
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from collections import Counter
from keras import layers
from [Link] import Input, Dense, Activation, ZeroPadding2D, BatchNormalization, Flatten, Conv2D
from [Link] import AveragePooling2D, MaxPooling2D, Dropout, GlobalMaxPooling2D, GlobalAveragePooling2D
from [Link] import Model
from [Link] import image
from [Link] import layer_utils
from [Link].data_utils import get_file
from [Link].imagenet_utils import preprocess_input
from [Link].vis_utils import model_to_dot
from [Link] import plot_model
from [Link] import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau
from [Link] import confusion_matrix
from [Link] import ImageDataGenerator
from [Link] import to_categorical
from keras import optimizers
import cv2
from itertools import chain
import glob
Link:- [Link]
Libraries
Pynput :-
It is used for controlling keyboard as we have used it for
controlling the space bar and arrow keys it helps to play, pause, forward and rewind the
media player.
Matplotlib:-
Matplotlib is a low level graph plotting library in python that serves as a
visualization utility.
Code
import cv2
import numpy as np
import [Link] as plt
from [Link] import load_model
from [Link] import Controller, Key
import time
cont= Controller()
flag = True
model = load_model('handmodel_fingers_weights.hdf5')
while True:
wind = [Link]((200,200,3))
_, frame = [Link]()
frame = [Link](frame, 1)
show = frame[50:200, 400:550]
frame = [Link](frame, (2,2))
gray = [Link](frame, cv2.COLOR_BGR2GRAY)
gray = gray[50:200, 400:550]
_, mask = [Link](gray,120 ,255 ,cv2.THRESH_BINARY_INV)
mask = mask / 255.0
mask = [Link](mask, (128,128))
mask = [Link](-1,128,128,1)
result=[Link](mask)
res = [Link](result)
#print(res)
[Link](wind, "{}".format(res),(50,125), cv2.FONT_HERSHEY_SIMPLEX,3,(0,255,0),2)
if flag:
if res == 0:
[Link]([Link])
elif res == 1:
[Link]([Link])
[Link]([Link])
flag = False
elif res == 2:
[Link]([Link])
[Link]([Link])
flag = False
elif res == 3:
[Link]([Link])
[Link]([Link])
flag = False
elif res == 4:
[Link]([Link])
[Link]([Link])
flag = False
[Link]("main", show)
[Link]("result", [Link](128,128))
[Link]("", wind)
end = [Link]()
if (end - start) > 2:
start = end
flag = True
if [Link](1) == 27:
break
[Link]()
[Link]()
Output
Output
Output