If you are interested in the freemium beta, please email: cyberseconspace@protonmail.com
Category: Cybersecurity
CONCLUSION
The main purpose of Computer Vision is to reproduce human vision.
It has a wide application in the civil and military fields e.g. for environmental monitoring.
It stands out in different varieties of the problem:
• Recognition
• Identification
• Detection
Doing the various tests and deepening the topic on the OpenCV, this library can be very useful also for road safety for example.
Today the automotive sector is having a strong impact with autonomous driving and for this the Computer Vision becomes fundamental not only for the driver but also for pedestrians incolumity, in the face of any obstacle while driving, preventing possible accidents by automatically activating the brakes for example.
About biometrics as a security tool for accesses into reserved areas with perimeter protection, it can affect privacy with the current computer vision and AI algorithms able to diagnose potential diseases, e.g. liver problems through eye analysis, or skin cancer.
Remaining on the topic of the thesis, to avoid false positive intrusions, it was reasoned that using the alarm in the case of a face detection is the simplest solution.
But if somebody presents with a mask in front of webcam, the facial recognition algorithm struggles a little to identify the features of the faces, so in our opinion for the initial purpose of monitoring our Laptop during working hours, the preference of the algorithm to use has simply fallen on the simplest motion detection.
FACE RECOGNITION
OpenCV uses cascades that is “a waterfall or series of waterfalls.” As an order of waterfalls, OpenCV cascade tackles the question of faces recognition into multiple phases. For each phase, it executes a very rude and rapid test. If the first check passes, it executes a softly more detailed test, and so on. The algorithm could have 30 to 50 of these phases or cascades, and if all phases pass it will identify a face. Pending the first phases the most frames taken in consideration will return a negative and this is a benefit, since the algorithm will not lose time controlling all 6,000 features on it. With the current calculation power face recognition can now be realized in real time.
Cascades in Python
The cascades are just a several of XML files holding OpenCV data used to identify objects. We can initialize our code with the cascade file for our porpouse, and then it works for us. OpenCV provides us a large number of just prepared cascades files for finding faces , eyes , hands , legs and body. There are also cascades for non-human things. In the following example there is the inclusion of haarcascade_frontalface_default.xml file
Python Code for Face Recognition
import cv2
import sys
import os
import time
#cascPath = sys.argv[1]
faceCascade = cv2.CascadeClassifier(‘haarcascade_frontalface_default.xml’)
video_capture = cv2.VideoCapture(0)
while True:
# Capture frame-by-frame
ret, frame = video_capture.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.1,
minNeighbors=5,
minSize=(30, 30),
flags=cv2.CASCADE_SCALE_IMAGE
)
# Draw a rectangle around the faces
for (x, y, w, h) in faces:
cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
cv2.imwrite(‘snap.jpeg’,frame)
os.system(“sendgmailc.exe”)
# Display the resulting frame
cv2.imshow(‘Video’, frame)
if cv2.waitKey(33) >= 0:
break
# When everything is done, release the capture
video_capture.release()
cv2.destroyAllWindows()
MOTION DETECTION
For motion detection the developer has to keep in mind a range of parameters with a key role:
• Robustness: the conditions change from a place to another, so developers have to keep in mind these situations to generate a software that is able to adapt to different variations of light and background;
• speed: processing communication in real time, it must be granted one video streaming performing enough to use this type of devices for all the elaboration;
• cost: after the values discount of hardware devices, it is now possible to delight with new types of interaction, because the systems house dedicated processors and code optimization for compression and image processing interfaces.
Evaluations and Considerations
The application of these algorithms is very effective for intercepting any change on the observed scene, but it is misleading as it can lead to false positives, such as changing the brightness in the environment or even moving the workstation location on which the webcam is housed or even a simple passage of a pet in front of the webcam for examples.
In this case the solution is to adopt the machine learning and computer vision.
OpenCV: library for Computer Vision
OpenCV is an open-source software developed for Intel architectures.
Machine vision is having a great success thanks to the low cost of image capture devices and high performance.
Some examples of its research areas are:
• motion tracking,
• human-machine interaction,
• identification and recognition of objects,
• face recognition,
• robotics algorithms.
OpenCV developed algorithms concern the filtering, the binarization, feature tracking, shape analysis, 3D reconstruction, camera calibration techniques, object recognition with histograms. Originally, the library was written only in C language; subsequently wrappers were written for other languages such as C#, Python, Ruby and Java.
Through the use of these new interfaces, the number of code lines necessary to call desired procedures is reduced, and common programming errors regarding the memory leak phenomenon are reduced, through allocations and deallocation of data structures, that led to a very easy approach for programmers.
To avoid false positives we must train the computer to face recognition.
We need a training phase to memorize the characteristics of the face that is recognized based on the positions and distances of 128 well-defined points.
Create Background Subtractor MOG2 function
OpenCV contains implementations of Background Segmentation. One of those is the class called BackgroundSubtractorMOG2, that is a Gaussian Mixture-based Background Segmentation algorithm, and it consists in fixing the background pixels and allocates a Gaussian Distribution to every pixel. The weight of this distribution is the number of time while the colors remain in the scene. The reasoning behind it is to identify the background using the information from the Gaussian mixture, ie more the color of the background remains the same
and more probability the observed scene is unmodified.
When between frame t-1 e frame t there is no movement, a completely black image is obtained, for the low-pass filter, on the contrary the movement will be detected by calculating the absolute difference between the two frames, obtaining white areas.
The graph of a Gaussian is a characteristic symmetric “bell curve” shape, a blurred image is obtained, to decrease the noise generated by the camera and it is salient when you want to drop the resolution of a frame. The Gaussian filter is of course the most convenient in which the new pixel value is the weighted average of the values in its neighborhood. These weights are distributed by Gaussian function, so: wider is the bell and then greater will be the effect of equalization or smooting.
Creates MOG2 Background Subtractor.
Parameters
History Length of the history.
varThreshold Threshold on the squared Mahalanobis distance between the pixel and the model to decide whether a pixel is well described by the background model. This parameter does not affect the background update.
detectShadows If true, the algorithm will detect shadows and mark them. It decreases the speed a bit, so if you do not need this feature, set the parameter to false.
The Mahalanobis distance is a measure of the distance between a point P and a distribution D, introduced by P. C. Mahalanobis in 1936. It is a multi-dimensional generalization of the idea of measuring how many standard deviations away P is from the mean of D.
Python code for motion detection
import numpy as np
import os
import time
import cv2
cap = cv2.VideoCapture(0)
# Gaussian Mixture-based Background/Foreground Segmentation
fgbg = cv2.createBackgroundSubtractorMOG2(50,200,True)
frameCount = 0
snapCount = 0
while(cap.isOpened()):
ret, frame = cap.read()
if frame is None:
break
frameCount += 1
resizedFrame = cv2.resize(frame,(0,0),fx=0.5,fy=0.5)
fgmask = fgbg.apply(resizedFrame)
count = np.count_nonzero(fgmask)
if(frameCount > 30 and count > 1000 ):
print(‘Motion detected’)
print(‘Frame: %d, Pixel Count: %d’ % (frameCount, count)
if(snapCount > 5):
cv2.imwrite(‘snap.jpeg’,frame)
snapCount = 0
os.system(“sendemailc.exe”)
else
snapCount += 1
cv2.imshow(‘frame’, resizedFrame)
cv2.imshow(‘mask’, fgmask)
if cv2.waitKey(33) >= 0:
break
cap.release()
cv2.destroyAllWindows()
Use Case Diagram
HIDS FOR WINDOWS
One hint of NIST is to configure systems to issue a log entry and alert on any successful and unsuccessful login to an administrative account.
When we buy a Windows Laptop for default the event of unsuccessful login is not enable. Why not even consider our laptop as a system to monitor and to use it as a system of motion detection?
Technologies and Methodologies
This section presents the libraries and algorithms used . The tool is an HIDS (Host Intrusion Detection System) that is not provided in Windows, so we have to intercept the security event when an account failed to log on, in order to react by sending an alert email to the laptop owner, for security auditing and accountability. The workstation has to be connected to Internet to send email, a good lighting is requested to take a picture too.
The environment where the prototype was developed and tested is Windows 7 and 10. The main programming language used is Python 3.5 or greater with Computer Vision library.
The application of this technology may touch the main sectors like:
· medical health: identifying and measuring human organs, and pathology;
· economic: once the system has been trained to recognize objects to be cataloged, such as vegetables in a supermarket without the need for a barcode reader and labels,
· Public Order: controlling people,
· traffic laws: for speed detector of vehicles
· Security: for video surveillance for example, etc.
IAAA
To grant the triad CIA we must adopt IAAA: Identification, Authentication Authorization and Accountability to avoid the nonrepudiation.
- Identification: includes all steps act to verify the identity of a user (ID card or Passport, Badge), process, or device, usually as a prerequisite for granting access to resources in an IT system
- Authentication: is the act of verifying the identity of a user, process, or device, often as a prerequisite to allowing access to resources in an information system. The process of verifying the identity or other attributes claimed by or assumed of an entity (user, process, or device), or to verify the source and integrity of data.
Multifactor Authentication consists in
- What you know: answering to question whose only you know the answer
- What you have: Token or OTP or RFID
- Who you are: Biometric
- Authorization Access privileges granted to a user, program, or process or the act of granting those privileges.
- Accountability: is the security goal that generates the requirement for actions of an entity to be traced uniquely to that entity. This supports nonrepudiation, deterrence, fault isolation, intrusion detection and prevention, and after-action recovery and legal action.
Access Control List
ACL is the process of granting or denying specific requests to obtain and use information and related information processing services applying a register of:
- users (including groups, machines, processes) who have been given permission to use a particular system resource, and
- the types of access they have been permitted.
Following are the main methodologies applied.
MAC DAC RBAC RuBAC
- MAC (Mandatory Access Control) supports a security requirement of confidentiality more so than the others.
- DAC (Discretionary Access Control) supports the security requirement of availability more so than the others.
- RBAC (Role Based Access Control) supports the security requirement of integrity more so than the others.
- RuBAC (Rule Based Access Control) access is allowed or denied to resource objects based on a set of rules defined by a system administrator. As with Discretionary Access Control, access properties are stored in Access Control Lists (ACL) associated with each resource object. When a particular account or group attempts to access a resource, the operating system checks the rules contained in the ACL for that object. As with MAC, access control cannot be changed by users. All access permissions are controlled only by the system administrator.
CRYPTOGRAPHY
We have to protect information and data at rest, while processing and in transit, all this also for nonrepudiation.
Encryption data is the best way at rest, for example in Oracle and Informix we can alter table containing personal data with the option encrypted using a cypher 512 bit AES, or there are many free tool (veracrypt) to encrypt HD partition where we can save any kind of file.
In transit, that is while data are transmit and in Pila ISO/OSI we are at 3 layer
we have to use security protocols like HTTPS, sftp, ssh, SSL/TLS, IPSec .
While processing we have to be warn that nobody is back our shoulder while treating personal data.
An example of Cryptography is that invented in 1993 by activist Phil Zimmerman [23] with twist key public and private, called PGP, Pretty Good Privacy.
(From RSA= Rivest Shamir Adlman : asymmetric cryptography with public key)
Privacy Protection
We also are responsible about every device in our own to maintain it patched, updated and upgraded.
But it is not enough, we need to start to have an awareness about all risk, not least that somebody want to steal our information in our laptop.
CIA Triad
In the middle of all there are the Data (from Latinum the meaning is given) to protect through the CIA triad:
1. confidentiality
2. integrity
3. availability
- For confidentiality NIST intends “preserving authorized restrictions on information access and disclosure, including means for protecting personal privacy and proprietary information. The property that sensitive information is not disclosed to unauthorized individuals, entities, or processes. The property that information is not disclosed to system entities (users, processes, devices) unless they have been authorized to access the information.”
- For integrity NIST intends “guarding against improper information modification or destruction, and includes ensuring information non-repudiation and authenticity. The property that sensitive data has not been modified or deleted in an unauthorized and undetected manner.”
- For availability NIST intends “ensuring timely and reliable access to and use of information. The property of being accessible and useable upon demand by an authorized entity.”
Origin of the right to privacy
The expression “right to privacy” is found in 1890 for the first time in an article signed by Warren and Brandeis which appeared in the magazine “Harvard Law Review”.The theme had already been dealt with only incidentally in the context of a treatise on illicit facts written by Judge Thomas Cooley in 1889: privacy was defined as “right to be let alone”.The right to privacy finds its formal definition in the “dissenting opinion of Brandeis in the Olmstead case vs United States 1928: “the Makers of our constitution undertook to secure conditions favorable to the pursuit of happiness. [] they conferred, as against the government, the right to be let alone – the most comprehensive of rights, and the right most valued by civilized men “.In the old continent, the terms of the law can be found in Art. 8 of the Convention for the Protection of Human Rights and Fundamental Freedoms (Rome 4 November 1950), which recognizes the right of everyone to respect for private and family life.
Data Breach
The GDPR in Europe for the protection of personal data has adopted a series of measures that establish public disclosure obligations for public administrations and companies in cases where, after cyberattacks, abusive accesses, accidents or adverse events, such as fires or disasters, the loss, destruction or undue dissemination of personal data stored, transmitted or otherwise processed should occur. The data breach is therefore a pillar of information security and a great challenge for public administrations and companies as it can be, from the point of view of transparency and accountability, the driving force for a new relationship both with citizens and with the Authority of Data Protection.When the violation of personal data presents a high risk for the rights and freedoms of people, the data controller must notify the concerned user of the violation without undue delay.