Detection of GUN Voilence in Surveillance Video using Open CV

DOI : 10.17577/IJERTCONV10IS08003

Download Full-Text PDF Cite this Publication

Text Only Version

Detection of GUN Voilence in Surveillance Video using Open CV

Raghavi. R

Department Of Information Technology, Jeppiaar Engineering College, Chennai

  1. Nirmal Kumar..,M.E (student)

    Department of Information Technology, Assistant Professor

    Jeppiaar Engineering College, Chennai

    Abstract Gun detection is a veritably serious and violent issue as far as the security and safety of the public in general, no doubt its a hard and delicate task likewise, its worrisome when you need to do it automatically or with some of the AI model. Different object discovery models are available but in case of discovery it's delicate to descry the munitions of distinctive size and shapes along with the different colors of the background. presently, a great deal of Cascade classifier grounded deep learning approaches are proposed for the recognition and in real- time. In this paper, we've done the relative analysis of the two performances which is the positive samples and negative samples. For training purpose, we produce munitions dataset and the images are collected from google images along with a portion of different means.

    KeywordsHand Gun Detection , Datasets, Cascade Classifier , Deep Learning Networks.


    Violence committed with Hand guns puts significant impact on public, health, and profitable cost. numerous people die each time from gun- related violence. Psycological trauma is frequent among children who are exposed to high situations of violence in their communities or through the media. Children exposed to gun- related violence, whether they're victims, perpetrators, or substantiations, can witness negative vibrations over the short and long terms. Number of studies show that handheld gun is the primary armament used for crimes like break- heft, thievery, shoplifting, and rape. These crimes can be reduced by relating the disruptive behaviours at early stage and covering the suspicious conditioning precisely so that law enforcement agencies can further take immediate action situations of gun- related violence vary greatly among geographical locales and countries. The global death risk from use of ordnance may be as high as dead each day. According to statistics,4.2 in 100000 people are killed in Pakistan every time in mass blow ups. From road crimes to an individual institution attack, numerous precious lives suffered.


      Reducing the life- hanging acts and furnishing high security are challenging at every place. thus, a number of experimenters have contributed to covering many condition and actions using object discovery. In general, a frame of smart surveillance system is

      developed on three situations originally, to prize low- position information like features engineering and object shadowing; secondly, to identify unusual mortal conditioning or discovery of any armament; and eventually, the high position is about decision making like abnormal event discovery or any anomaly. The rearmost anomaly discovery ways can be divided into two groups, which are object- centered ways and integrated styles. The convolutional neural network( CNN) spatial- temporal system is only applied to spatial-temporal volumes of interest( SVOI), reducing the cost of processing. In surveillance vids of complex scenes, experimenters in proposed a tool for detecting and chancing anomalous conditioning. By conducting spatial-temporal complication subcaste, this armature helps one to capture objects from both time sphere and frequence sphere, thereby rooting both the presence and stir data decoded in nonstop frames. To do traditional functions to original noise and ameliorate discovery perfection, spatial-temporal complication layers are only enforced within spatial-temporal amounts of changing pixels. Experimenters proposed anomaly- introduced literacy system for detecting anomalous conditioning by developing multi-instance literacy graph- grounded model with abnormal and normal bimodal data, pressing the positive cases by training coarse sludge using kernel- SVM classifier and generating advanced dictionary literacy known as anchor wordbook literacy. therefore, abnormality is measure by opting the reconstruction cost which yields the comparison with other ways including exercising abnormal information and reducing time and cost for SRC. Jietal. developed a system for security footage which automatically identifies the mortal guns using convolutional neural nets( CNNs) by forming deep literacy model which operates directly on the raw inputs. Some of the disadvantages are:

      • Doesn't work well with large dataset as calculating distances between each data case would be veritably


      • Doesn't work well with high dimensionality as this will complicate the distance calculating process to calculate distance for each dimension.

        • Sensitive to noisy and missing data


In this exploration work, we aim to develop a smart surveillance security system detecting Hand Guns . For

this purpose, we've applied many vision styles and deep literacy for identification of a armament from captured image. Recent work in the field of machine leaning and deep learning particularly Cascade classifier has shown considerable progress in the areas of object discovery and recognition, simply in images. As the first step for any videotape surveillance operation, object discovery are essential for farther object tracking tasks. For this purpose, we trained the classifier model ,this model is a state- of- the- art real- time object discovery classifier.

Figure 2: Work Of The Proposed System

  1. Working Of Algorithm :

    Cascade are generally done through cost- apprehensive ADAboost. The perceptivity threshold(0.8 in our illustration) can be acclimated so that there's close to 100 true cons and some false cons. The procedure can also be started again for stage 2, until the asked calculation time is reached. Every stage of the classifier cannot have a discovery rate( perceptivity) below the asked rate, so this is a constrained optimization problem. To be precise, the total perceptivity will be the product of stage perceptivity. Cascade classifiers are available in OpenCV, with pre- trained for anterior faces and upper body. Training a new algorithm in OpenCV is also possible with either haar_training or train_cascades styles. This can be used for rapid-fire object discovery of further specific targets, including non-human objects with Haar- suchlike features. The process requires two sets of samples negative and positive, where the negative samples correspond to arbitrary non-object images. The time constraint in training a classifier can be circumvented using pall- computing style

    Figure 2 : Shows The Algorithm Work Design



      The order of color is BGR( blue, green, red). The OpenCV function imwrite() that saves an image assumes that the order of colors is BGR, so it's saved as a correct image.. thus, if the and array of the image read by OpenCV imread() is converted to a PIL. RGB stands for Red Green Blue. Most frequently, an RGB color is stored in a structure or unsigned integer with Blue enwrapping the least significant" area"( a byte in 32- bit and 24- bit formats), Green the alternate least, and Red the third least. BGR is the same, except the order of areas is reversed RGB to Grayscale Conversion is performed in order to simplify the complexity of each frame and speed up the operation of the posterir .

      Figure 3: shows the conversion process of rgb to gray scale


      This system is used to find focus objects by segregating them while comparing them to the frame where no objects are present; it'll find the differences between them and produce a distance matrix. principally what it does is compare the difference in the value of two frames, one frame without an object and the other with objects to count, with the threshold value.

      Figure 4: A Flow Diagram Of Background Subtraction

      Figure 5:Shows The Sample Image Of Background Subtraction


      Canny edge Discovery is a fashion to prize useful structural information from different vision objects and

      dramatically reduce the quantum of data to be reused. It has been extensively applied in computer fundamentals systems. Canny has set up that the conditions for the operation of edge discovery on different vision systems are fairly analogous. As the dangerous object can be at any position in the focus frame a sliding window fashion is used. A sliding window is a blockish region of fixed range and height that slides across an image.

      Figure 6: Canny Detection Graph

    4. ALERT


Python provides smtplib module, which defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon. Here is a simple syntax to create one SMTP object, which can later be used to send an e-mail

import smtplib smtpObj = smtplib.



PyCharm is the most popular IDE used for Python scripting language. This chapter will give you an preface to PyCharm and explains its features. PyCharm offers some of the stylish features to its druggies and inventors in the following aspects

  • Advanced remedying

  • Support for web programming and fabrics similar as Django and Flask


    In the Output phase, we apply the same feature extraction process to the new images and we pass the features to the trained machine learning algorithm to predict the label.

    Figure 7: Shows The Result Of The Analysis In Real Time. It

    Detect A Hand Gun With Trained Input Images Accurately.

    From this model we can conclude the accuracy rate of the algorithm .

    Figure 8: shows the location of the hand gun detected


    From the Table I, declares the testing of the algorithm in all possible ways


In this research paper, Comparative analysis have been made for the two versions of the art object detection algorithm known as Cascade algorithm .We have done a fact-finding comparative analysis for a weapons detection task. We take the beginning from the outline of the

versions, take a look at the architecture and improvements of the preceding versions.

Unfortunately due to time constraints, we were unable to optimize for the time performance of classification; each classification took around 1.3 seconds, which is likely too long for any live video feed through a surveillance or body camera; more work is needed to test the available classifiers and optimize performance for both accuracy and speed.


We thank the Management, Jeppiaar Engineering College for providing the opportunity.

We would like to thank the Principal, HOD of Information technology and the Department Professors for their Guidance and Support.

We would also like to thank our friends for their help and Motivation throughout this project.


[1] Moez Baccouche, et al. Sequential deep learning for human action recognition. International Workshop on Human Behavior Understanding. Springer Berlin Heidelberg, 2011. 2

[2] Samir K. Bandyopadhyay, Biswajita Datta, andSudipta Roy Identifications of concealed weapon in a Human Body Department of Computer Science and Engineer, University of Calcutta, 2012. 2

[3] Aaron Damashek and John Doherty Detecting guns using parametric edge matching Project for Computer Vision Course: CS231A, Stanford University, 2015.

[4] Claire-Hlne Demarty, et. al The MediaEval 2012 affect task: violent scenes detection Working Notes Proceedings of the MediaEval 2012 Workshop. 2012.

[5] Roberto Olmos, Siham Tabik, and Francisco Herrera Automatic Handgun Detection Alarm in Videos Using Deep Learning Soft Computing and Intelligent Information Systems research group, Department of Computer Science and Artificial Intelligence, University of Granada, 2017. 1, 2

[6] K. Simonyan, A. Zisserman Very Deep Convolutional Networks for Large- Scale Image Recognition Visual Geometry Group, Department of Engineering Science, University of Oxford, 2015. 1, 2

[7] Russell Stewart Tensorbox 1, 2

[8] Pierre Sermanet, et. al Overfeat: Integrated recognition, localization and detection using convolutional networks Courant Institute of Mathematical Sciences, New York University, 2013. 2

[9] Pierre Sermanet, et. al You only look once: Unified, real- time object detection Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2016. 2

[10] Dumitru Erhan, et al Scalable object detection using deep neural networks Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2014.

[11] Shaoqing Ren, Kaiming He, Ross Girshick, Jian Sun Faster r-cnn: Towards real-time object detection with region proposal networks Advances in neural information processing systems, 2015. 2

[12] Joseph Redmon and Anelia Angelova Real-time Grasp Detection Using Convolutional Neural Networks Robotics and Automation (ICRA), 2015 IEEE International Conference on.

IEEE, 2015. 2

[13] Chung Yu Wang and Cheng-Yue Royce Traffic Sign Detection using You Only Look Once Framework Technical Report Project for Computer Vision Course: CS231N, Stanford University, 2015. 2

[14] Deng, Jia, et al. Imagenet: A large-scale hierarchical image database Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on. IEEE, 2009.

[15] Suresh Babu V, Anu George, Image Forgery Detection using Global, Local and Histogram Features, Technology and Future

Journal of Science and Technology, Volume 1, Issue 1, page no.52-58,2014.

[16] S Vijayan and Jestin V K Suresh Babu V, Survey on Identification Of Microaneurysm In Retinal Image Using Support Vector Machine International Journal of Applied Engineering Research, volume 10, Issue 67, Page no 17-22,