Figure 1. Diatom (left) and its gradient amplitude (right).
This distribution is dated September 30, 2024. It includes the complete set of source files, along with the precompiled classes.
This Java class is based on the following paper:
M. Unser, "Splines: A Perfect Fit for Signal and Image Processing," IEEE Signal Processing Magazine, vol. 16, no. 6, pp. 22-38, November 1999.
It is written as a plugin for ImageJ. Please read the ImageJ documentation to learn how to install the plugin.
This plugin allows you to perform several differentiation operations on images, seen as continuous functions, even though they are stored as discrete pixels. The general principle is to construct the continuously defined function
ƒ(x, y) = ∑k,l c[k,l] ⋅ φ(x-k, y-l).
Here, we shall concentrate on the specific case where the function
φ(x, y) = β3(x) ⋅ β3(y)
is a tensor-product (separable) cubic B-spline. Then, a typical example of spatial differentiation operation is
∂ƒ(x, y) ⁄ ∂y = ∑k,l c[k,l] ⋅ β3(x-k) ⋅ ∂β3(y-l) ⁄ ∂y,
where we compute the exact vertical gradient of the continuously defined image.
Figure 2. Possible operations.
√( (∂ƒ(x, y) ⁄ ∂x)2 + (∂ƒ(x, y) ⁄ ∂y)2 ).
arc tan( (∂ƒ(x, y) ⁄ ∂y) ⁄ (∂ƒ(x, y) ⁄ ∂x) ),
along with considerations on the sign of ∂ƒ(x, y) ⁄ ∂y and of ∂ƒ(x, y) ⁄ ∂x.∂2ƒ(x, y) ⁄ ∂x2 + ∂2ƒ(x, y) ⁄ ∂y2.
The following pair of images is typical of the kind of results you can obtain with the present program. The image on the left is the original image, while the image on the right shows its Laplacian.
Figure 3. Left: 256×256 Lena input image. Right: Resulting Laplacian.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
You undertake to include a citation or acknowledgment whenever you present or publish results that are based on this program. EPFL makes no warranties of any kind on this software and shall in no event be liable for damages of any kind in connection with the use and exploitation of this technology.
The class Differentials_ contains the five following methods:
getCrossHessian | ↔ | (∂ƒ(x, y) ⁄ ∂x) ⋅ (∂ƒ(x, y) ⁄ ∂y) |
getHorizontalGradient | ↔ | ∂ƒ(x, y) ⁄ ∂x |
getHorizontalHessian | ↔ | ∂2ƒ(x, y) ⁄ ∂x2 |
getVerticalGradient | ↔ | ∂ƒ(x, y) ⁄ ∂y |
getVerticalHessian | ↔ | ∂2ƒ(x, y) ⁄ ∂y2 |
These methods have two parameters each and perform the in-place processing of an object of type ImageProcessor, given as first parameter. The only image type that is currently implemented is ImagePlus.GRAY32.
The second parameter is a variable of type double that controls the compromise between speed and accuracy. Its value should be a small positive or null number. The best precision is achieved by setting tolerance = 0.0, at the expense of some (moderate) loss in efficiency. We have observed experimentally that the value that corresponds to the C constant FLT_EPSILON exhibits an excellent trade-off. In Java, this value can be written as Float.intBitsToFloat((int)0x33FFFFFF).