In this article I am going to tell you a little code made in Python, in order to make an object invisible. Counted in this way it sounds like "magic" for not beyond reality, it is still the union of a couple of very simple technologies.

One of them is the so-called ComputerVision where it can be said that it is the part of Artificial Intelligence that works on the vision of objects, that is, it tries to imitate human visualization and how that data reaches the neurons for interpretation. In this example that we are going to do, it is something very simple and far from it reaches the complexity of this type of programming.

The other technology where we can place this activity is in the Augmented Reality part, where the use of color saturation and masks works a lot.

Well, without further ado let's explain the code that can make this possible. The first thing I must say is that the code refers to the work of Kaustubh sadekar and where it helped me to put it into practice.

The idea is very simple and is based on a Python code where it records the first 30 frames of the image in front of your webcam. Staying with the last static image.

Once we have this, there is a chosen color where the Python script saturates it, using HSV codes to impersonate only the pixels of that color, with the image that has the background, making that invisible effect possible.

In order to play with different colors here I leave you a website where you can go from RGB to HSV in a simple way.

Here I leave the code already prepared to do the activity using a red object. Remember that you must run it on a computer with Python3.6 or higher installed and with the libraries of OpenCV and numpy.

To install OpenCV and numpy you can do it using the command pip

pip install opencv-python
pip install numpy