2016-12-24 2 views
-1

ImageJのthis java classを使用して、javaで自分の画像をノイズ除去しようとしています。ImageJのNon Local Means DenoisingアルゴリズムをJavaコードで実装するにはどうすればよいですか?

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を得るように見えることはできません。

私の試みはthese two classes (the github page linked to from ImageJ's website)と一緒に、このテストクラスに私をリードしてきました。

ご協力いただければ幸いです。

答えて

0

最終的に私の質問に対する答えが見つかりました。

全体のテストクラスは、次のようになります。

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"); 
} 
} 
関連する問題