Organize and Share your Electronics the way you want. Sign-Up for a free account now. It takes only 30 seconds!

OpenCV 3 Python blur detection

OpenCV 3 Python blur detection

logoIn 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.

out_13

Note red bar at the bottom indicating focus quality

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.

7

Focus quality distribution vs time

Script

Read more Here

 

More Articles to Read

Vertical Pole Climbing Robot
Vertical Pole Climbing Robot
ESP8266 Weather Station Projects
ESP8266 Weather Station Projects
Single tube Lethal Nixie clock
Single tube Lethal Nixie clock
How to make a simple 1 watt audio amplifier (LM386 based)
How to make a simple 1 watt audio amplifier (LM386 based)
Flashing Binaries to DRA7xx Factory Boards Using Device Firmware Upgrade
Flashing Binaries to DRA7xx Factory Boards Using Device Firmware Upgrade
Dot² isn’t your typical coffee table
Dot² isn’t your typical coffee table
Debugging ARM Cortex-M0+ HardFaults
Debugging ARM Cortex-M0+ HardFaults
EMP Jammer build
EMP Jammer build
A 3D-printed e-drum pad
A 3D-printed e-drum pad
Interactive geodesic LED dome = extreme geometric fun!
Interactive geodesic LED dome = extreme geometric fun!

Top




Shares