{"id":26715994,"url":"https://github.com/mashybasker/invcloak","last_synced_at":"2025-04-14T00:35:21.126Z","repository":{"id":111550924,"uuid":"587237757","full_name":"MashyBasker/invcloak","owner":"MashyBasker","description":"Image Processing demonstration project for the event PyNova by FreeScape IIIT Kalyani","archived":false,"fork":false,"pushed_at":"2023-07-24T03:21:13.000Z","size":1862,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T14:51:23.135Z","etag":null,"topics":["image-processing","opencv","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MashyBasker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-10T09:32:31.000Z","updated_at":"2023-03-04T09:00:17.000Z","dependencies_parsed_at":"2025-03-27T14:44:19.675Z","dependency_job_id":"ea217ea3-65ea-43e0-b76e-e6aecc63ffe1","html_url":"https://github.com/MashyBasker/invcloak","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MashyBasker%2Finvcloak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MashyBasker%2Finvcloak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MashyBasker%2Finvcloak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MashyBasker%2Finvcloak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MashyBasker","download_url":"https://codeload.github.com/MashyBasker/invcloak/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248802141,"owners_count":21163785,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image-processing","opencv","python3"],"created_at":"2025-03-27T14:38:57.614Z","updated_at":"2025-04-14T00:35:21.120Z","avatar_url":"https://github.com/MashyBasker.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Invisibility Cloak \n\nThis is a project for the event **PyNova** by the **FreeScape IIIT Kalyani** club.\n\nThis is a very popular project, and I will be following some articles and/or github links, all of which we will provided as references for the reader to peruse.\n\nWe will be using OpenCV for this project. \n\nThe idea behind the work is that we first capture the background image. Then we detect and segment the cloth(it is important that a **red** cloth is used, as the code has been written for that specific colour).\n\n\n## Detection and segmenation\n\nFirst we need to detect the color we want inside the image/frame and create a mask for colors in a range. This will help us to segment out every object inside the image/frame whose color belong in that range.\n\nThis is achieved by the following piece of code:\n\n```python\n#converting BGR image to HSV\nhsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)\n#lower limit of the range\nlow_blue = np.array([110, 50, 50])\n#upper limit of the range\nhigh_blue = np.array([130, 255, 255])\n#creating the mask\nmask = cv2.inRange(hsv, low_blue, high_blue)\n#applying the mask\nres = cv2.bitwise_and(img, img, mask=mask)\n```\nThe variable `res` is the final image/frame with the color segmented out\n\nNormal Image | Blue segmented\n:----------------------:|:----------------:\n![Normal](assets/blue_flower.jpg) | ![Segmented](assets/blue_segmented_flower.png)\n\nThe code is available [here](utility-funcs/segment_color.py)\n\n\n## Showing background\n\nNow we have a foor loop for 100 iterations in the beginning of the code to capture the background without the human inside it. After segmenting the color from the image, we will display the background through the color segmented part in the frame. \nFor example, the code [here](utility-funcs/color_seg.py) segments yellow color from the frame, this segmented mask is used for showing the background through this mask [here](utility-funcs/backg_seg.py). \n\nShowing the background through the mask is achieved by this piece of code:\n\n```python\n#generating the mask\nmask = color_segment(frame)\n#applying the mask\nres = cv2.bitwise_and(frame, frame, mask=mask)            \n#add background on the mask\nres3 = cv2.bitwise_and(backg, backg, res, mask=mask)\n```\n\nAs I was wearing a yellow T-shirt, the background could be seen through my shirt.\n\n\u003cimg src=\"assets/backg_segmented.gif\" alt=\"demo\" width=\"300px\" height=\"210px\"\u003e\n\n\n## References/Links\n\n- [Invisible cloak using OpenCV](https://learnopencv.com/invisibility-cloak-using-color-detection-and-segmentation-with-opencv/)\n- [Invisible cloak using OpenCV(GeeksForGeeks)](https://www.geeksforgeeks.org/invisible-cloak-using-opencv-python-project/)\n- [Color segmentation](https://medium.com/srm-mic/color-segmentation-using-opencv-93efa7ac93e2)\n- [OpenCV documentation](https://docs.opencv.org/master/index.html)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmashybasker%2Finvcloak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmashybasker%2Finvcloak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmashybasker%2Finvcloak/lists"}