In the continuation of the article about the restoration of defocused and blurred images I want to share my results with the Wiener filter for restoring real images. OpenCV 3.4 was used as an image processing library. Camera - Nikon D320, Nikon DX AF-S NIKKOR 18-105mm lens, defocusing was done manually, shooting was done without a tripod.
During defocusing, the distorting system is well approximated by a cylindrical point spread function (PSF) of radius r.
Cylindrical PSF
Below are the results of the restoration of three real defocused images of the same object (book page). The survey was carried out without a tripod from a distance of approximately 50 cm. The degree of defocusing of the lens manually increased from frame to frame. The Wiener filter parameters r and the signal-to-noise ratio (SNR) were selected manually in such a way as to provide the best visual quality of the recovery. To compensate for edge effects, a gradual decrease in the brightness of the image at the edges is made.
Picture A
Result of image restoration A. r = 53, SNR = 5200
Picture B
Result of image recovery B. r = 66, SNR = 4400
Picture C
Result of image restoration C. r = 102, SNR = 7100
It can be seen that even with a significant defocusing, the readability of the text is practically
fully recovered.
Image blur occurs when the camera and the object move relative to each other during exposure. Consider only the case when the subject is moving linearly relative to the fixed camera. In this case, the distorting system is well approximated by the PSF in the form of a segment, which is directed along the motion of the object. Such PSF is defined by two parameters: L length and THETA blur angle.
PRT with linear lubrication
Below is a distorted image of two cars, obtained with insufficiently short exposure, which led to a noticeable blurring.
Distorted image of two cars
Below are the results of the restoration of the numbers of both cars using the Wiener filter. The values of the parameters L, THETA and SNR were selected in such a way as to ensure the best visual quality of the car number recovery.
The result of the restoration of the number of light car. L = 78, THETA = 15, SNR = 300
The result of the restoration of the dark car number. L = 125, THETA = 0, SNR = 700
It can be seen that even with significant lubrication it is possible to restore the readability of numbers
cars.
The filtering algorithm is implemented in C ++ OpenCV as a console application.
Source codes can be found at the links below.
https://github.com/VladKarpushin/out_of_focus_deblur/tree/full_color_version
https://github.com/VladKarpushin/motion_deblur
https://docs.opencv.org/4.0.0-alpha/de/d3c/tutorial_out_of_focus_deblur_filter.html
https://docs.opencv.org/4.0.0-alpha/d1/dfd/tutorial_motion_deblur_filter.html
Source: https://habr.com/ru/post/424987/
All Articles