Ask Your Question

Adaptative Gaussian Filter.

asked 2017-05-03 07:11:13 -0600

Soarez gravatar image

Hello, i wanna apply a Gaussian kernel to the image, but the thing is .... just to a certain part. I have a big image, 2064/1544 +/-, most of the image is black and i don't need it. Gaussian blur apply th kernel to the full image and takes time, although i have made a custom Gaussian for my problem.

My cycling to each pixel : 1. check if pixel its over a Threshold value. 2. if positive apply Gaussian kernel to the surroundings.

My code works correctly and if i get a TH value to 0, i got the same result as the Gaussian blur function, Gaussian Blur is always faster.

Question: there is already a function like this!? Question: If not , how can i optimize my code!?

edit retag flag offensive close merge delete


No there is no such function in opencv. You can crop your image and apply blur to new image

LBerger gravatar imageLBerger ( 2017-05-03 07:40:56 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-05-03 08:49:04 -0600

pi-null-mezon gravatar image

As LBerger said there is no default masking option for smooth operations in opencv. For the speed up you can divide your image into several regions (for the instance in the same number as your system CPU cores) and process them in parallel, then stitch all results together. Opencv contains simple to use API for such optimizations. For the instance you can read this.

edit flag offensive delete link more


thank you , i go check it out!

Soarez gravatar imageSoarez ( 2017-05-03 09:47:23 -0600 )edit

Question Tools

1 follower


Asked: 2017-05-03 07:11:13 -0600

Seen: 229 times

Last updated: May 03 '17