简体   繁体   中英

ImageJ API: Usage of Filter in my own Code

I would like to filter a image using ImageJ API. The ImageJ libary is correctly connected to my project.

Now I want to process the image with an average filter from the API. How does that work?

public Image filterMyImage(ImagePlus imagePlus) 
{
        // IMAGEPLUS FILTERING PROCESS HERE

        return image;
}

I assume by "average filter" you mean a mean filter with a 3x3 kernel, in which case you could do:

ImageProcessor ip = imagePlus.getProcessor();
ip.smooth();
return ip.getBufferedImage();

The documentation for the smooth method is here . If you want a median filter on a 3x3 kernel instead, you could use the method medianFilter .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM