Deblur image that has locally varying (but well known) motion blur

Hi, I have an image where motion blur occurs due to long exposure photographing. I know the amount of motion blur for each pixel of the image. Is there a way to de-motion-blur this image with a locally varying de-blur algorithm?
I have attached images that show the original, motion-blurred image, and the x and y blur amount (in pixel units). The original Matlab data is located here:
Should I segement the image into smaller sub-images and then deblur each sub-image? Isn't there a nicer way...? Could you give me a hint where I can start? Thanks!!
William
p.s.: The dataset is not perfect as there are additional sources of image blurring too (caused by lens misalignment, lower left corner for example). But this is the best dataset I currently have.

Antworten (3)

Bjorn Gustavsson
Bjorn Gustavsson am 4 Apr. 2022

0 Stimmen

Some time ago I wrote a pair of simple "variable-psf-blurring and variable-psf-deblurring" functions. They at least work OK-ish for the case where the psf-s are nearly separable into a pair of horizontal and vertical psf-s that varies smoothly over the image. For this type of task you might have to go to the litterature, or do it region-by-region from scratch. For what it is worth, I attach the varying-psf-tools.
HTH
Dear Bjorn, thanks for your reply! I had a look at your code, but I think it will take me some more time to understand if I can use for my case...
I also tested the idea of dividing the image into tiles, and de-blur each tile with the local, known blur. But the results don't look too promising... This code can be tested with the dataset that is linked in my first post here.
% very quick and dirty test
clear
close all
clc
load example_dataset.mat
[theta,rho] = cart2pol(displacement_x,displacement_y);
step=15;
A_deblurred=A;
for i=1:step:900-step
for j=1:step:900-step
A_sub=A(i:i+step,j:j+step);
rho_sub=(rho(i:i+step,j:j+step));
theta_sub=(theta(i:i+step,j:j+step));
%take the average of every tile
rho_sub=mean(rho_sub(:));
theta_sub=mean(theta_sub(:));
%calculate PSF for every tile
PSF_sub = fspecial('motion',rho_sub,rad2deg(theta_sub));
if rho_sub >=2 %deblur only if there is significant motion
%A_deblurred(i:i+step,j:j+step) = deconvblind(A_sub,PSF_sub); %alternative deblurring
A_deblurred(i:i+step,j:j+step) = deconvlucy(A_sub,PSF_sub);
else
A_deblurred(i:i+step,j:j+step) =A(i:i+step,j:j+step) ;
end
end
end
imagesc(imadjust(A/max(A(:))))
figure;
imagesc(imadjust(A_deblurred/max(A_deblurred(:))))

4 Kommentare

Yeah, I didn't have time to look at your image, so I was hoping that your "other problems" weren't too bad, and that my quick-and-easy-toy would get the job done. No I have taken a very QD-look at your image, it seems that the motion-blurring is not the dominant problem. To my eyes it seems like you have rather uggly case of astigmatic aberations that dominate (?) at least the left region of the image. For such psf-s their variation across the image has to be taken into account, but unfortunately they look like seaguls (at least to me that was the first association I got first time looking at them). For that I think you'll have the most success by dividing the image into small enough regions, and then estimate the psf by selecting a few isolated sources (stars?) and scale those to unit total intensity and use them in the Lucy-Richardson-deconvolution. Perhaps have a reasonably large overlap between regions too.
Hi,
my question is only about the motion blur. The other problems can be compensated by tweaking the setup, the motion blur is the interesting part to me. That is the part where I have a good knowledge aubout the PSF. But I don't know how to sufficiently deblur the image with the known PSF. Currently the results look pretty ugly (see code)...
Doesn't your or any of the other PIV-tools on the file exchange handle this type of problem? Are you really happy with the motion-blurring filters produced by fspecial? When I displayed them for each 15-by-15 block they looked rather peculiar to me. Does your particles move parallel enough to the image plane for that simplistic motion-blur to be valid? Is it worthwhile to try to solve this problem on images with this aberration-limited focus?
Yes, they handle this pretty well, although it is commonly accepted (at least in text books) that motion blur must be avoided (the reason is not given). Now I started to develop PIV illumination systems using pulsed laser diodes. These do inherently have longer pulse durations than true pulsed lasers (µs instead of ns). I want to know if motion blur really is a problem. Initial tests with synthetic images show that it doesn't really matter that much. However, I also found a paper that deals with deblurring (and they actually use my software for validation):

Melden Sie sich an, um zu kommentieren.

Image Analyst
Image Analyst am 6 Apr. 2022

0 Stimmen

You might want to try BM3D. In addition to being arguably the best denoising algorithm out there, it also does deblurring. Here is an example:
The original is on the left. The blurred input image is in the middle, and the deblurred/repaired image is on the right. It looks almost like the original. You can get the MATLAB code here:
Alternatively you could try a Mean Shift Filter, a total variance deblurring, or others. Many are in the File Exchange:
Try some of them and see what works well for you. Such as

Kategorien

Mehr zu Programming finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2021b

Tags

Gefragt:

am 4 Apr. 2022

Beantwortet:

am 6 Apr. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by