Skip to content

Commit 13eeb19

Browse files
mkcorstefanv
andcommitted
Reorganize docstring notes
Co-authored-by: Stefan van der Walt <[email protected]>
1 parent 04f7231 commit 13eeb19

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

skimage/restoration/_rolling_ball.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
def rolling_ball(image, *, radius=100, kernel=None, nansafe=False, num_threads=None):
88
"""Estimate background intensity using the rolling-ball algorithm.
99
10-
This function estimates the background intensity of an n-dimensional
11-
image. Typically, it is useful for background subtraction in case of
12-
uneven exposure. It is a generalization of the well-known rolling-ball
13-
algorithm [1]_.
10+
This function is a generalization of the rolling-ball algorithm [1]_ to
11+
estimate the background intensity of an n-dimensional image. This is
12+
typically useful for background subtraction in case of uneven exposure.
13+
Think of the image as a landscape (where altitude is determined by
14+
intensity), under which a ball of given radius is rolled. At each
15+
position, the ball's apex gives the resulting background intensity.
1416
1517
Parameters
1618
----------
@@ -39,20 +41,14 @@ def rolling_ball(image, *, radius=100, kernel=None, nansafe=False, num_threads=N
3941
4042
Notes
4143
-----
42-
The algorithm is easy to grasp in 2D: Consider that each pixel value
43-
defines a height, forming a 2D surface in 3D space. Then, a (3D) ball of
44-
given radius (or a kernel, in the general case) is placed under this
45-
surface and raised until it touches it. The background intensity is
46-
estimated by the hull of the volume reachable by the ball.
47-
48-
Clearly, for this method to give meaningful results, the radius of the
49-
ball (or typical size of the kernel, in the general case) should be (much)
50-
larger than the typical size of the image features of interest.
51-
5244
This implementation assumes that dark pixels correspond to the background. If
5345
you have a bright background, invert the image before passing it to this
5446
function, e.g., using :func:`skimage.util.invert`.
5547
48+
For this method to give meaningful results, the radius of the ball (or
49+
typical size of the kernel, in the general case) should be larger than the
50+
typical size of the image features of interest.
51+
5652
This algorithm is sensitive to noise (in particular salt-and-pepper
5753
noise). If this is a problem in your image, you can apply mild
5854
Gaussian smoothing before passing the image to this function.

0 commit comments

Comments
 (0)