Fully Ported to Python from ImageJ's Background Subtractor.Only works for 8-bit greyscale images currently.
Project description
Rolling ball and sliding paraboloid background subtraction algorithms
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 = subtract_background_rolling_ball(img, 30, light_background=True,
use_paraboloid=False, do_presmooth=True,
create_background=False)
background = subtract_background_rolling_ball(img, 30, light_background=True,
use_paraboloid=False, do_presmooth=True,
create_background=True)
Example outputs
Input
Subtracted background
Without background
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file opencv-rolling-ball-1.000000.tar.gz
.
File metadata
- Download URL: opencv-rolling-ball-1.000000.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95bbc4b55801cc39970a5e5d1869be699ec975f9b350bbfbd33e109e36fec3c9 |
|
MD5 | 21a3f17100cae8297f11a68b4f10663c |
|
BLAKE2b-256 | 255221def60639ac831ed057afb32d8ab3d979232bba3cf65e437c5a823f85b2 |