# Uneven background subtraction: Rolling ball vs Disk tophat

A classical technique in still images (e.g. fluorescence microscopy images) to remove uneven illumination and isolate bright blobs is to use morphological operation such as the top-hat transform.

For instance the Rolling-ball algorithm[1] uses a ball as a structuring element and performs the top-hat transform[2].

The structuring element is a grayscale element that extends the disk structuring element in 3D. For instance in MATLAB:

se2 = strel('ball', 3, 3);
0    0.4999    0.9997    1.4996    0.9997    0.4999         0
0.4999    0.9997    1.4996    1.9995    1.4996    0.9997    0.4999
0.9997    1.4996    1.9995    2.4994    1.9995    1.4996    0.9997
1.4996    1.9995    2.4994    2.9992    2.4994    1.9995    1.4996
0.9997    1.4996    1.9995    2.4994    1.9995    1.4996    0.9997
0.4999    0.9997    1.4996    1.9995    1.4996    0.9997    0.4999
0    0.4999    0.9997    1.4996    0.9997    0.4999         0


My question is: Is it so much better than simply using a binary disk as a structuring element? What are the use cases where a rolling ball is way better, or even required?

My experiments with comparing the outputs of the two do not show a striking difference between the two, but the literature behind the Rolling ball is very abundant.

[1] Stanley Sternberg, "Biomedical Image Processing", IEEE Computer, January 1983

[2] Here is the source code for a Java implementation in ImageJ: http://rsbweb.nih.gov/ij/plugins/download/Rolling_Ball_Background.java