Download the source code
ou
Go to Github

Context

Nowadays, we often use computers and connected devices. Most of them have an embedded webcam: computers and mobile phones are just a few examples. These cameras are very useful for communicating through social networks. However, this technology shows dangers: some hackers are able to exploit your webcam to spy on you.
The purpose of this article is to raise awareness and make recommendations on the use of web cameras.
To do this, I propose Kivy Camera, an application that recovers the video stream from your webcam to display it on the screen. The application has the following features:

  • Camera connection (webcam)
  • Capture of video stream
  • Picture taking

Firstly, we will show how the application is built. Then, we will enumerate the possible functionalities and actions to be carried out. Finally, we will propose the limits and recommendations regarding the application and use of a webcam.

Kivy, a framework for interfaces

The KivyCam application and its graphical interface are built with the Kivy framework.
Kivy is a cross-platform framework that allows you to create graphical interfaces for Python applications. The advantages of this framework are its power and its simplicity regarding implementation.
Its use in this project is based on a need for simplicity and lightness.

GANTT planning

Before going into design, it is good practice to plan the project, even for a small application.
This project was therefore organized through Gantt planning:


Creation of the user interface

The interface of the Kivy Camera application has been designed and implemented with the idea of simplicity in mind:

This interface is enhanced with several buttons where each one corresponds to an action:

  • START button, starts the webcam and video stream capture.
  • STOP button, completes the capture of the video stream. This action is accompanied by a return to the "main screen"
  • SCREENSHOT button, takes an instant screenshot from the data contained in the video stream at a t time, only if the video stream capture is active.

Image capture

Image capture is a feature of the application that allows the user to take instant photographs of his webcam.

By pressing the SCREENSHOT button while capturing the video stream, a capture is saved as an image file in the "screenshots" folder at the root of the application folder.

Installation of dependencies

The prerequisites for launching Kivy Camera are to install, if this is not already the case:

  • Python3 and pip
  • Kivy

Installing Python3

First of all, regardless of your operating system, check that Python has been installed by typing the following command:

							
								python3 --version
							
						
Windows

Download a version of Python3 https://www.python.org/downloads/windows/ and install it.

Mac OS

Python is installed by default on the system. If not installed, install "brew" and install python3 with the following commands:

							
								/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
								brew install python
							
						
Linux

							
								sudo apt-get install python3
								sudo apt-get install python3-pip
							
						

To test that Python has been installed correctly on the system, we check its version with the command:

							
								python3 --version
								pip3 --version
								pip --version
							
						
Kivy installation
Windows
							
								/* Tout d’abord, pour éviter des problèmes, veuillez à mettre à jour pip : */
								python -m pip install --upgrade pip wheel setuptools virtualenv
								python -m pip install docutils pygments pypiwin32 kivy_deps.sdl2==0.1.22 kivy_deps.glew==0.1.12
								python -m pip install kivy_deps.gstreamer==0.1.17
								/* Avec python 3.5+, kivy_deps.angle à la place de glew : */
								python -m pip install kivy_deps.angle==0.1.9
								python -m pip install kivy==1.11.1
							
						

Mac OS
							
								python -m pip install kivy
								python -m pip install ffpyplayer
							
						

Note: You must configure a KIVY_VIDEO=ffpyplayer environment variable before running the application.

Linux
							
								python -m pip install --upgrade --user pip setuptools virtualenv
								python -m pip install kivy
								python -m pip install ffpyplayer
							
						

Note: for this application, it is necessary to have a Linux with a graphical interface, otherwise kivy will not compile.

Downloading the application and installing from Github

This part may require basic technical skills in Python.
If you want to test the application, I invite you to download the project from the address https://github.com/ValentinDumas/KivyCam.
Once the code has been downloaded from the Github link, open the archive to access the files. You can use the 7zip software to open the archive, downloadable at https://www.7-zip.org. As an alternative to 7zip, we can suggest WinRar, downloadable at https://www.win-rar.com/start.html?&L=10.
To use the application, open a console window (cmd.exe). Then move to the project folder "cd path_to_project_folder". Then execute the following command to launch the application: "python camlayout.py"

Ethical dimension

The use of this application and webcams in general raises several points related to an ethical dimension.

Confidentiality and data protection

Access to a private device without the owner's knowledge constitutes a violation of privacy and is a matter of confidentiality and user data protection.
Using the Python language for example, it is possible:

  • Use a webcam "locally", i.e. directly from your computer
  • Access a webcam of a target machine from a network. Of course, for each connected machine there are protections (e.g. remote access protection via the network for Windows PCs)
For these reasons, users of connected devices are advised to keep these protections are active by default on their machine and to remain vigilant for malicious emails that may contain fraudulent links with viruses.

Possible improvements

We could go further in the development of the Kivy Camera application by offering:

  • A video recording using two buttons, start and end of capture
  • Give a user the possibility to choose the machine to which he wants to connect through a network
  • Propose an "automatic launch" script or an executable of the application for all platforms
  • An executable of the application can be added on Github in the "Release" section to improve visibility

Kivy Camera