Ask Your Question

java code for smoothing image using openCV library functions

asked 2013-02-12 10:22:58 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

i found many C++ codes in net but couldnt get java code...we are trying to implement all the basic operations on an image using openCV library using java language.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-02-12 10:46:56 -0600

Java API for OpenCV is here. Personally, I found the C/C++/Python doc more readable, but maybe just because I'm not familiar with javadoc style... Nevertheless, you can look at C/C++/Python explanations of the functions, and found in javadoc how to use it.

edit flag offensive delete link more

answered 2014-01-21 23:18:58 -0600


you could use something as simple as:

public Mat blur(Mat input, int numberOfTimes){
        Mat sourceImage = new Mat();
        Mat destImage = input.clone();
        for(int i=0;i<numberOfTimes;i++){
            sourceImage = destImage.clone();
            Imgproc.blur(sourceImage, destImage, new Size(3.0, 3.0));
        return destImage;

which blurs an image using the normalized box filter, using a 3x3 grid around each pixel on the image. This method also let's you define the number of times you want to smooth it.

Kind regards, Daniel

edit flag offensive delete link more

Question Tools


Asked: 2013-02-12 10:22:58 -0600

Seen: 5,274 times

Last updated: Jan 21 '14