Reputation: 259
I am new on Stackoverflow and this is my first question, so please be patient with me.
I want to blur an image with a non uniform filter.However, I have not fully understood what is a non-uniform filter and I would like to ask what does exactly an non-uniform filter do and how can that be intepreted in terms of a code. I want to implement this in Matlab. Hereby is an example of my code.
A non-uniform kernel would be that
init= imread('cameraman.jpg');
initial = rgb2gray(init);
sigma=3;
H_filt = fspecial('gaussian',[5 5], sigma);
or would be restricted to only one dimension?
init= imread('cameraman.jpg');
initial = rgb2gray(init);
sigma=3;
H_filt = fspecial('gaussian',[5 1], sigma);
Thanks in advance fellows!!
Upvotes: 1
Views: 2244
Reputation: 9379
Non uniform blur kernels
A non-uniform blur kernel is a kernel that is not constant over the whole image.
To take some examples:
How to generate a non uniformly blurred image
It depends on how many blur kernels your image has, and what kind of blur you want to emulate.
(i,j)
: for example sigma_ij = f(i,j)
H_ij = fspecial('gaussian', [some large size], sigma_ij])
I_final[i,j] = I_blurred_with_Hij[i,j]
In some cases, you can cut this greedy loop with correct assumptions (blur size limit, only two or 3 possible blurs in the image...).
Upvotes: 3
Reputation: 4953
Usually they mean a filter which isn't constant for each pixel -> It is not uniform spatially.
Try to implement a Gaussian Blur which its Standard Deviation is different at each pixel.
A fast way to do so is using colfilt
.
If you need more help let me know.
Upvotes: 1