This MR adds a new unsharp mask mode, compatible with the one of ImageJ.
mode="imagej"
for UnsharpMask
mode="imagej"
for CudaUnsharpMask
mode="imagej"
for OpenclUnsharpMask
Imagej Unsharp Mask plugin is available here:
/** Unsharp Mask filtering of a float image. 'fp' must have a valid snapshot. */
public void sharpenFloat(FloatProcessor fp, double sigma, float weight) {
if (gb == null) gb = new GaussianBlur();
gb.blurGaussian(fp, sigma, sigma, 0.01);
if (Thread.currentThread().isInterrupted()) return;
float[] pixels = (float[])fp.getPixels();
float[] snapshotPixels = (float[])fp.getSnapshotPixels();
int width = fp.getWidth();
Rectangle roi = fp.getRoi();
for (int y=roi.y; y<roi.y+roi.height; y++)
for (int x=roi.x, p=width*y+x; x<roi.x+roi.width; x++,p++)
pixels[p] = (snapshotPixels[p] - weight*pixels[p])/(1f - weight);
}