Skip to main content

Rolling ball and sliding paraboloid background subtraction algorithms

PyPI version Downloads License: MIT

Fully Ported to Python from ImageJ's Background Subtractor. Only works for 8-bit greyscale images currently. Based on the concept of the rolling ball algorithm described in Stanley Sternberg's article, "Biomedical Image Processing", IEEE Computer, January 1983. Imagine that the 2D grayscale image has a third (height) dimension by the image value at every point in the image, creating a surface. A ball of given radius is rolled over the bottom side of this surface; the hull of the volume reachable by the ball is the background. http://rsbweb.nih.gov/ij/developer/source/ij/plugin/filter/BackgroundSubtracter.java.html

This algorithms are perfect for microscope images, to distinguish particles from background.

Installation

pip install opencv-rolling-ball

Usage

import cv2
from cv2_rolling_ball import subtract_background_rolling_ball

img = cv2.imread(f'path/to/img.tif', 0)
img, background = subtract_background_rolling_ball(img, 30, light_background=True,
                                     use_paraboloid=False, do_presmooth=True)

Example outputs

Input

Input

Subtracted background

Background

Without background

Without background

Metadata

Release files for opencv-rolling-ball 1.0.1

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

Source distribution (sdist)

Source distribution for opencv-rolling-ball 1.0.1
File Size Uploaded Provenance Actions
opencv-rolling-ball-1.0.1.tar.gz 6.2 kB Without provenance Details for opencv-rolling-ball-1.0.1.tar.gz

Release files / opencv-rolling-ball-1.0.1.tar.gz

Download URL opencv-rolling-ball-1.0.1.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
095111fae47056692b44fee9e8f635dcc095276f07ba496738d9f06a27d1fe46
BLAKE2b-256 checksum
How to use checksums
86a7b210b66daf1d6beb12f5d5c8bc2f91a3b37f5fb520d6728d7c05ef4e6c14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6

Security for opencv-rolling-ball 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file No provenance

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