Subtract the background from orignal Image.
This package will help in segmentation of the body from the background. This package is based on mediapipe selfie segmentation and cvzone.
- Function Parameter : This function takes
orignalImgi.e. the image on which the segmentation has to happen. Other parameters i.e.
backgroundImgsets the background color, by default it is white, but it can be changed as per user's need. threshold defines the level at which background has to be removed.
- Output : The functions returns a frame as output where the background is segmented.
Default Segmentation (White Background)
from lkbodysegmentation import bodySegmentation import cv2 cap = cv2.VideoCapture(0) while True: success, img = cap.read() img = bodySegmentation(img) cv2.imshow('Image',img) cv2.waitKey(1)
bodySegmentation(img, backgroundColor, threshold)
from lkbodysegmentation import bodySegmentation import cv2 cap = cv2.VideoCapture(0) while True: success, img = cap.read() backgroundColor = (255,0,255) #You can replace with an image too threshold = 0.45 #Level of background to be erased img = bodySegmentation(img,backgroundColor,threshold) cv2.imshow('Image',img) cv2.waitKey(1)
This package is developed by Lakshay Kumar an enthusiastic AI Researcher. This is developed keeping in mind the pain to write lengthy lines of code just to detect faces. This will enable other developers to focus more on implementation part rather than spending time on coding the face detection module.
Feel free to share your feedback via mail
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for lkbodysegmentation-0.0.1-py3-none-any.whl