Non-Local means denoising Plugin makes all edges orange

Tags: #<Tag:0x00007fb87d65c3d0> #<Tag:0x00007fb87d65c1a0>


[JAVA] My code for running the ImageJ plugin is as follows:

import ij.IJ;
import ij.ImagePlus;
import ij.plugin.PlugIn;

public class Test implements PlugIn {

  public static void main(String[] args) {

    Test test = new Test();"Denoise.ijm");


    public void run(String arg0) {
      String directory = "C:\\Users\\Speedy Octopus\\Desktop\\10Cover Shots\\10.JPG";

      ImagePlus imp = IJ.openImage(directory);
      FileSaver fileSaver = new FileSaver(imp);

      System.setProperty("plugins.dir", "C:\\Users\\Speedy Octopus\\Downloads\\ij150-win-java8\\ImageJ\\plugins");, "Non-local Means Denoising", "sigma=5 smoothing_factor=1");
      fileSaver.saveAsJpeg("C:\\Users\\Speedy Octopus\\Desktop\\10Cover Shots\\10edited.JPG");

After running the remove noise macro, all of the edges of my images are turned orange. how can I stop this from happening?

This also happens when I use the actual ImageJ.jar program

Starting image
Denoised image


Welcome to the forum, @nexion21!

Firstly, just to clarify for other readers: the Non Local Means Denoise is part of the Biomedgroup update site.

I was able to reproduce the orangeification of the edges on my local machine by running the “Non-local Means Denoising” plugin on the image above.

Maybe @twagner has some insight into this phenomenon?

As a workaround, the problem does not occur if you first Split Channels, run the denoising on each of the R, G and B channels individually, and then Merge Channels again afterward.

(Unfortunately, there appears to be a bug if you Make Composite on the image and try running the denoising on that:

java.lang.ArrayIndexOutOfBoundsException: 1
	at ij.plugin.filter.PlugInFilterRunner.processOneImage(
	at ij.plugin.filter.PlugInFilterRunner.processStack(
	at ij.plugin.filter.PlugInFilterRunner.<init>(



Thanks for your response! My knowledge with ImageJ is extremely limited so without your response I would have been outta luck, I really appreciate your help.

I ended up getting it working with the following code in my run method:

ImagePlus imp = IJ.openImage(directory);
FileSaver fileSaver = new FileSaver(imp);

System.setProperty("plugins.dir", LocalMethods.readFile("NonLocalMeansDir").get(0));

ImagePlus[] channels = ChannelSplitter.split(imp);
String[] channelTitles = new String[3];
for (int i = 0; i < channels.length; i++) {
  ImagePlus channel = channels[i];
  channelTitles[i] = channel.getTitle();, "Non-local Means Denoising", "sigma=5 smoothing_factor=1");
}, "Merge Channels...", "c1=[" + imp.getTitle() +  " (" + channelTitles[0] + ") " + "] c2=[" + imp.getTitle() +  " (" + channelTitles[1] + ") " + "] c3=[" + imp.getTitle() +  " (" + channelTitles[2] + ") " + "] create");
IJ.saveAs("jpeg", directory);