【问题标题】:How can I implement ImageJ's Non Local Means Denoising algorithm in Java code?如何在 Java 代码中实现 ImageJ 的非局部均值去噪算法?
【发布时间】:2017-05-09 15:40:03
【问题描述】:

我正在尝试使用 ImageJ 中的 this java class 在 java 中对我的图像进行降噪。

我的尝试使我与these two classes (the github page linked to from ImageJ's website)一起参加了这个测试课程:

import ij.ImagePlus;
import ij.process.ByteProcessor;
import ij.process.ImageProcessor;

public class Test {

public static void main(String[] args) {
    String directory = "C:\\Users\\Speedy Octopus\\Desktop\\Noise Reduction\\Before Denoising.JPG";
    BufferedImage image = ImageUtility.loadImage(directory);

    ImageProcessor ip = new ByteProcessor(image.getWidth(), image.getHeight());
    String title = "New Image";
    ImagePlus imp = new ImagePlus(title, ip);

    NLMeansDenoising_ nlmd = new NLMeansDenoising_();
    nlmd.setup("final", imp);
    nlmd.run(ip);
    }
}

但我似乎无法正确完成 nlmd.setup()。

任何帮助将不胜感激。

【问题讨论】:

    标签: java image-processing imagej


    【解决方案1】:

    我终于找到了我的问题的答案。

    整个 Test 类现在看起来像这样:

    import ij.IJ;
    import ij.ImagePlus;
    import ij.io.FileSaver;
    import ij.plugin.PlugIn;
    
    
    public class Test implements PlugIn {
    
    public static void main(String[] args) {
    
        Test test = new Test();
        test.run("Denoise.ijm");
    
    }
    
    @Override
    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");
        IJ.run(imp, "Non-local Means Denoising", "sigma=5 smoothing_factor=1");
        fileSaver.saveAsJpeg("C:\\Users\\Speedy Octopus\\Desktop\\10Cover Shots\\10edited.JPG");
    }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-19
      • 2019-04-20
      • 1970-01-01
      • 2015-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-25
      相关资源
      最近更新 更多