Skip to main content

A collection of unsupervised clustering tools for foreground segmentation

Project description

FOREground segMENTation

A collection of unsupervised clustering tools for foreground segmentation of an image to isolate an object of interest.

Requirements:

  • ultralytics
  • opencv-python
  • orchard-bouman

Developed in Python 3.10, but anything over Python 3.7 should work

Installation:

pip install forement

Usage:

To use from the command line use the command:

python forement.py -image_path -method -k -channel -output_dir -save_image -show_image

Arguments:

  • image_path, type=str, help=Input the path to the image to perform clustering on.
  • method, type=str, help=Method to segment images by, options include "sam", "kmeans", "ob", "em", "ob-em".
  • k, type=int | None, default=None, help=How many clusters to generate. For method "ob" or "ob-em" clusters is 2^k.
  • channel, type=int, default=0, help=Color channel to use when running mode counts on images.
  • output_dir, type=str | None, default=None, help=Folder to save images to. If None, created images are saved in the folder of the original image.
  • save_image, type=bool, default=False, help=Whether or not to save the segmented image.
  • show_image, type=bool, default=False, help=Whether or not to display the segmented image.

Available methods:

  • kmeans: "kmeans"
  • Orchard Bouman: "ob"
  • Expectation Maximization: "em"
  • Expectation Maximization using Orchard Bouman: "ob-em"
  • SAM (Segment anything model): "sam"

In addition to the command line call, all functions can be imported to your own scripts and used as part of a larger program.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forement-0.0.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

forement-0.0.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file forement-0.0.1.tar.gz.

File metadata

  • Download URL: forement-0.0.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for forement-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ec03f54fa4e8d8bde7edb6156256e160ca3c2c1ce0987ab8d6712964cc4f9415
MD5 d8d5cf283ce8a8270a3b8d97f9fc5fc9
BLAKE2b-256 ed5e475944c09d486a925ccd1d1351973a95915ef73d2f76bd97caba0a83f946

See more details on using hashes here.

File details

Details for the file forement-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: forement-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for forement-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a122578ded5c16d25b45096b40674b74a47f59a680f4501422ca60d0a096727
MD5 98bb787928dad1fcf9875371177eaed0
BLAKE2b-256 4f2d153f24ec1c611888b1f253f5b5a525474cd9d999f976322b2f5b69f42c6a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page