Now function returns both result image and subtracted background
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.
pip install opencv-rolling-ball
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)
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size opencv-rolling-ball-1.0.1.tar.gz (6.2 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for opencv-rolling-ball-1.0.1.tar.gz