Skip to main content

About

This package will help in segmentation of the body from the background. This package is based on mediapipe selfie segmentation and cvzone.

Function

bodySegmentation(orignalImg,backgroundImg=(255,255,255),threshold=0.3)

  • Function Parameter : This function takes orignalImg i.e. the image on which the segmentation has to happen. Other parameters i.e. backgroundImg sets 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.

Usage

bodySegmentation(img)

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)

Customized Segmentation


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)

Developer

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

Release files for lkbodysegmentation 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for lkbodysegmentation 0.0.1
File Interpreter ABI Platform
lkbodysegmentation-0.0.1-py3-none-any.whl Python 3 none any Details

Release files / lkbodysegmentation-0.0.1-py3-none-any.whl

Download URL lkbodysegmentation-0.0.1-py3-none-any.whl
Size 2.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b8ea8015d83ce8e5e4cacf8896c3b62934d67d0168de0c8acb0cfa119817a97
BLAKE2b-256 checksum
How to use checksums
e103d514bb128f0827a1f6e5571017771a6b5dcf37846bf5da953769a7b3fbad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.2

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page