How to implement a non uniform blur?

조회 수: 2 (최근 30일)
Françoise
Françoise 2016년 4월 22일
댓글: Image Analyst 2016년 4월 25일
Hey there. I've been trying to find a way to apply an out-of-focus filter that mimics that of a camera when focusing on a close object. Basically, the center (or the focal point of the image) is completely clear, but as you move away from it, the image gets blurrier and blurrier. This is, a blur that is not uniform across the image.
Is there any way of implementing this? I've tried by dividing the image into blocks and blurring each block separately, but in the end it didn't work (all I got was an image with concentric circles of different brightness, not an uniform image.)
Any help with this will be greatly appreciated.

답변 (1개)

Alessandro Masullo
Alessandro Masullo 2016년 4월 22일
I don't know if this would be the best solution, but what you need is basically a filter that depends on the spatial position. In particular, I was thinking of a modified version of conv2.
You could rewrite the conv2 function in matlab code (you can google it) and change the kernel in a way that it depends on the position of the pixel where it is applied. Then, you can convolve your original image with a Gaussian whose size depends on the (x,y) position in your image. According to the function that you choose for the Gaussian, you'll have different blur.
  댓글 수: 2
Françoise
Françoise 2016년 4월 25일
Thanks a lot! That sounds like a good idea. Actually, I managed to find a script over the weekend to implement a gradient blur, and it proved to be just what I needed.
Thanks a lot!
Image Analyst
Image Analyst 2016년 4월 25일
One form of this is called "field curvature" https://en.wikipedia.org/wiki/Petzval_field_curvature It's one of the optical aberrations, some others being spherical aberration, distortion, astigmatism, coma, longitudinal chromatic aberration, lateral chromatic aberration, and defocus.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by