Author- AI Legend
13Feb|2024|06min read

Invisible Cloak...

Let's do some kind of Magic in our Planet .....

Seems like a daydreamer for many of us right...Like visiting to Hogwarts and acquire a knowledge of magical spells just like a Harry Potter & his friends woah!
I always imagined to be invisible for a moment then I found something in which scientists and researchers are still researching ...And see what they invented, and this device said to be Invisible Cloak methodology.

What is the perspective to design ?..

The Cloak be a magic & invisible inside HArry Potter movie. As we all knew there is no magic at all right, possibly its a science trick.Now... What is the concept behind this magic? Let's see...invisibility is a fusion of science fantasy and collective imagination, we can say. Althogh I tried to make my invisible cloak via python codes... Curiosity high to see how its happening!

Fig. Architecture of Invisible cloak

Project Prerequisites:


● Python – Version 3.x or above(we use here version 3.10)
● Numpy -1.19.2
● OpenCV -4.5
● Selection of IDE for project as per your choice (we are using Pycharm and it is also works on VS Code)
● For deployment of project we used here github.

Now let's start understanding how it's working practically ::

Basic requirements::
We need to choose a highly saturated color cloth and I'll choose red color because it's my favourite although you can choose any from your wardrobe to make yourself ivisible folk i.e.red, green or blue (rgb), because these are highly sturated color.Now if we sected red then ensure that our background does not contain any red colour. Because if the background contains that colour, then it will cause problems alright.

Finally we replaced the cloak region with the background delegatory. Now need such section of main frame in which the clock absent. To achieve noisefree cloak, simply transpose the mask and repeat again similar instructions ...

5. np.ones((5,5),np.uint8) create a 5×5 8 bit integer matrix. Adjust kernel size according to your condition.
Why HSV?
HSV stands for HUE, SATURATION, and VALUE (or brightness). It is a cylindrical color space.

HUE: The hues are modeled as an angular dimension which encodes color information.

SATURATION: Saturation encodes intensity of color. for example.if we use pink color then due to less saturation it cannot detect it properly right.

VALUE: Value represents the brightness of the color.

6. cv2.cvtColor() function converts colorspace. Lower bound and Upper bound are the boundaries of green color.
cv2.inRange() function returns a segmented binary mask of the frame where the green color is present.

7. cv2.bitwise_and() applies mask on frame in the region where mask is true (means white).

Now finally Removing unnecessary black ad white noise from mask :

8. cv2.MORPH_CLOSE removes unnecessary black noise from the white region in the mask. And how much noise to remove that is defined by kernel size. cv2.MORPH_OPEN removes unnecessary white noise from the black region. cv2.dilate increases white region in the image.

Results


This is the output of Machine Learning Project...

In the above Machine Learning Project, we delegatory generated Invisible Cloak via OpenCV technology using Python code.We accomplished image segmentation & color detection technique of AI. Here, in computer vision project, we acquire knowledge regarding morphological operations, masking techniques, and etc rest image processing conceptualization.

Conclusion and Future Scope


In this project, we have implemented simple masking techniques and Morphological Operations to get the coloured cloth out of the frame and instead of that, we are showing the background.
OpenCV is a vast field and has many practical applications available in the industry like object detection, motion detection, facial recognition, and nowadays many organizations are using the same in the name of AI and Computer Vision for developing surveillance systems to keep track of criminal activities.
Another reason for its useful its execution speed and efficiency as compared to other image processing libraries. Once you dive into it, will open the way for many innovative ideas and fun projects like you can control a racing game with gloves in your hand or else you can be invisible in your online video classrooms and many more.
It will not be the real cloak but some graphical tricks with OpenCV and Python to make things invisible in front of the camera based on colour detection and colour segmentation techniques. The same has been done for an android camera using OpenCV and Python.


Reference


Xiaojun Jia, "Fabric defect detection based on open source computer vision library OpenCV", 2nd International Conference on Signal Processing Systems, 23 August 2010.
Image Segmentation Using Color Spaces in OpenCV + Python, [online] Available: Click me
HSV color space, [online] Available: www.learnopencv.com.
Morphological operations (Erosion Dilation morphological open), [online] Available: Click me

People also search...


People who read also read this