Now we have to set the values of the color of the cloth that we picked so here we pick RGB format of red color so you can choose any color cloth and change those values Step 6: Using Morphological Transformations to remove noise from the cloth and unnecessary Details. Now a lot is happening in Step 5, in this part, we are trying to set the values for our cloth so that when we run our program we will eliminate these colors like in above we mentioned the cloth is of red color so we are setting the color for this cloth so that when we make mask it will simply be removed from the screen and instead of this the only color it shows the background which we captured in step 3. #After combining the mask we are storing the value in deafult mask.
![invisible blanket invisible blanket](https://i.ytimg.com/vi/1ZM9xLV2i6c/hqdefault.jpg)
#Combining the masks so that It can be viewd as in one frame Mask2 = cv2.inRange(hsv,lower_red,upper_red) Mask1 = cv2.inRange(hsv, lower_red,upper_red) Upper_red = np.array() # values is for red colour Cloth
![invisible blanket invisible blanket](https://i.pinimg.com/originals/a6/bb/be/a6bbbefa322239e7e14039b9984f2781.jpg)
Step 5: Setting the values for the cloak and making masks #all this Comes in the while loop
#Invisible blanket code
for i in range(50):Ĭondition for this is when only the webcam is opened it will only run else the code will not run in the background without the webcam Now we have to take the values of the red color cloth to take any values and change till then the red color will start to disappear from the frame. In the time function, we have used the value so that the video can be captured in the first 2 seconds after running the program.Ĭapturing the Image of the background in the first two seconds. #To use webcam enter 0 and enter the video path in double-quotes. Step 2: Using the WebCam to take the Video Feed
![invisible blanket invisible blanket](https://futurearchitectureplatform.org/media/cache/59/40/594084b553b7e7a0df2c980aa0a89696.jpg)
So to take the webcam feed, we use VideoCapture Function It used by the default webcam. Now we have Imported the Libraries we now have to use VideoCam on your device to work. Step 1: Importing the Libraries # Import Libraries So, now let us start the Implementation of this Project. combining the mask and showing it simultaneouslyĭon’t worry if you are not getting the algorithm we will get to it slowly and it will be a lot easier on the implementation.making 2 masks and applying them to the frame.Setting the values for the Cloak that the cloth we selected we have to now set the values for it.Capturing the background firstly we have to capture the background so that if the cloth comes in it shows the background.using a webcam to capture the live feed of the person and the background.firstly Import the Libraries that we can use to make the project.
#Invisible blanket install
To install Numpy, run this command on your terminal pip install numpyįor writing code for a project, it is always good to have a plan or an Algorithm which containing all the things you are planning to do. To install OpenCV, run the command in your terminal pip install opencv-python
![invisible blanket invisible blanket](https://cdn.shopify.com/s/files/1/2178/8329/products/invisible-world-100-baby-alpaca-throw-blanket-or-shawl-santiago-13296221913157_2048x.jpg)
Because if the background contains that color then it will cause problems.