OpenCV 3 Python blur detection
In order to detect if picture is in focus modern consumer cameras use complicated phase detection circuitry and specialized sensors. But how to determine if captured picture is in focus after it has been taken. Having this measurement information can help in many ways (select best picture in a sequence, control motorized lens, clean time-lapse video and many other).
In our case Laplacian transformation, while not being perfect solution, can distinguish between same scene focused and blurred frames. While it is hard to describe what Lapliacian function does, you can always read more details on Wikipedia pages.
Again I will be using OpenCV to solve this problem. Let’s capture short video clip and run script to see the results. Script is in a way that displays video file with quality bar at the bottom and saves text file with numerical result for further analysis.
Whole clip analysis indicated that function can distinguish if in focus very precisely. Unfortunately has hard times determining blur level in extreme conditions.
To display focus/blur distribution over time I used LibreOffice graph function. Below is visual blur over frame nr representation.
Comments ( 2 )