For the degradation image model theory and the Wiener filter theory you can refer to the tutorial Out-of-focus Deblur Filter. On this page only a linear motion blur distortion is considered. The motion blur image on this page is a real world image. The blur was caused by a moving subject.
What is the PSF of a motion blur image?
The point spread function (PSF) of a linear motion blur distortion is a line segment. Such a PSF is specified by two parameters: LEN is the length of the blur and THETA is the angle of motion.
Point spread function of a linear motion blur distortion
How to restore a blurred image?
On this page the Wiener filter is used as the restoration filter, for details you can refer to the tutorial Out-of-focus Deblur Filter. In order to synthesize the Wiener filter for a motion blur case, it needs to specify the signal-to-noise ratio ( SNR), LEN and THETA of the PSF.
Source code
You can find source code in the samples/cpp/tutorial_code/ImgProc/motion_deblur_filter/motion_deblur_filter.cpp of the OpenCV source code library.
The functions calcWnrFilter(), fftshift() and filter2DFreq() realize an image filtration by a specified PSF in the frequency domain. The functions are copied from the tutorial Out-of-focus Deblur Filter.
Result
Below you can see the real world image with motion blur distortion. The license plate is not readable on both cars. The red markers show the car’s license plate location.
Motion blur image. The license plates are not readable
Below you can see the restoration result for the black car license plate. The result has been computed with LEN = 125, THETA = 0, SNR = 700.
The restored image of the black car license plate
Below you can see the restoration result for the white car license plate. The result has been computed with LEN = 78, THETA = 15, SNR = 300.
The restored image of the white car license plate
The values of SNR, LEN and THETA were selected manually to give the best possible visual result. The THETA parameter coincides with the car’s moving direction, and the LEN parameter depends on the car’s moving speed. The result is not perfect, but at least it gives us a hint of the image’s content. With some effort, the car license plate is now readable.
Note
The parameters LEN and THETA are the most important. You should adjust LEN and THETA first, then SNR.
You can also find a quick video demonstration of a license plate recovering method YouTube.
Generated on Sun Jun 5 2022 16:19:53 for OpenCV by 1.8.13