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

7 vues (au cours des 30 derniers jours)
William Thielicke
William Thielicke le 4 Avr 2022
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.

Réponses (3)

Bjorn Gustavsson
Bjorn Gustavsson le 4 Avr 2022
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

William Thielicke
William Thielicke le 4 Avr 2022
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 commentaires
Bjorn Gustavsson
Bjorn Gustavsson le 5 Avr 2022
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?
William Thielicke
William Thielicke le 6 Avr 2022
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):

Connectez-vous pour commenter.


Image Analyst
Image Analyst le 6 Avr 2022
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

Tags

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by