Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mbalatsko/opencv-rolling-ball
Fully Ported to Python from ImageJ's Background Subtractor. Rolling ball and sliding paraboloid background subtraction algorithms.
https://github.com/mbalatsko/opencv-rolling-ball
background-subtraction image-processing imagej python3 rolling-ball sliding-paraboloid
Last synced: about 2 months ago
JSON representation
Fully Ported to Python from ImageJ's Background Subtractor. Rolling ball and sliding paraboloid background subtraction algorithms.
- Host: GitHub
- URL: https://github.com/mbalatsko/opencv-rolling-ball
- Owner: mbalatsko
- License: mit
- Created: 2018-03-11T10:35:33.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-06-21T21:15:02.000Z (over 2 years ago)
- Last Synced: 2024-11-01T21:42:16.883Z (2 months ago)
- Topics: background-subtraction, image-processing, imagej, python3, rolling-ball, sliding-paraboloid
- Language: Python
- Homepage:
- Size: 1.7 MB
- Stars: 42
- Watchers: 4
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Rolling ball and sliding paraboloid background subtraction algorithms
[![PyPI version](https://badge.fury.io/py/opencv-rolling-ball.svg)](https://badge.fury.io/py/opencv-rolling-ball)
[![Downloads](https://pepy.tech/badge/opencv-rolling-ball)](https://pepy.tech/project/pypylon-opencv-viewer)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/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
```bash
pip install opencv-rolling-ball
```## Usage
```python
import cv2
from cv2_rolling_ball import subtract_background_rolling_ballimg = 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](https://raw.githubusercontent.com/mbalatsko/opencv-rolling-ball/master/outputs/example.png)
#### Subtracted background
![Background](https://raw.githubusercontent.com/mbalatsko/opencv-rolling-ball/master/outputs/example_bg.png)
#### Without background
![Without background](https://raw.githubusercontent.com/mbalatsko/opencv-rolling-ball/master/outputs/example_roll.png)