Aniket Patil
Aniket Patil

Reputation: 37

Blur image using Opencv in JAVA

I am working on image blur functionality. To achieve this I am using opencv with JAVA. But the blur ratio of the image is according to the quality of the uploaded image, means if I upload low quality image, then it blurs the image as expected, but if I upload high quality image, then it blurs the image in very minor proportion. How can I set the parameters to this line so that the blur effect is same for all images(means it is independent of the uploaded image quality) Imgproc.GaussianBlur(source, destination,new Size(39,39),0);

Upvotes: 0

Views: 852

Answers (2)

Gitaram Kanawade
Gitaram Kanawade

Reputation: 351

Try to convert all images in consistent size.

example:If you have image with dimension 455x550 convert it into 300x300.Likewise you have one consistent dimension.convert all images in same dimension before applying blur effect.

Upvotes: 0

Mayank
Mayank

Reputation: 363

Recently even i have been working on something very similar.

In your case you are working with kernel size of 39*39. So if i assume you are getting best result when you use the image of size 500*500 (width and height of source image).

So in your case if your image is 500 use kernel size of 39 (ratio of 500/39=12.82)

Now if you increase the image size (high resolution image) also try to increase the kernel size with same proportionality.

For example now if you feed an image of size 1000*1000 then make the kernel size as 78.

So basically use dynamic kernel size for blurring.

If you can be specific about the case where you are implmenting it, you can get much better answer specific to your situation.

Hope that helps. Dont forget to upvote.

Upvotes: 1

Related Questions