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

Pinned onto

Related Pins

Arduino Stopwatch
Arduino Stopwatch
App note: General overview of IR transmission in free ambient
App note: General overview of IR transmission in free ambient
Sonicare toothbrush teardown: microcontroller, H bridge, and inductive charging
Sonicare toothbrush teardown: microcontroller, H bridge, and inductive charging
App note: Using Vishay infrared receivers in a Wi-Fi environment
App note: Using Vishay infrared receivers in a Wi-Fi environment
Skill Sunday: Uploading to your Arduino via a Network
Skill Sunday: Uploading to your Arduino via a Network
One Phase Power Meter
One Phase Power Meter
WiFi Toilet Vacancy Sensor
WiFi Toilet Vacancy Sensor
HAL 9000 reimagined as a useless machine
HAL 9000 reimagined as a useless machine
Using the XMEGA Clock System
Using the XMEGA Clock System
An Arduino VU meter for classrooms
An Arduino VU meter for classrooms
DIY Calculator
DIY Calculator
Build your own robotic vacuum from scratch
Build your own robotic vacuum from scratch
An animatronic talking takeout container
An animatronic talking takeout container
Restoring a Xerox Alto day 7: experiments with disk and Ethernet emulators
Restoring a Xerox Alto day 7: experiments with disk and Ethernet emulators
IDE 1.6.12 released with Sierra support and more
IDE 1.6.12 released with Sierra support and more
IoT Propane Tank
IoT Propane Tank
Industry Standard Single-Ended Current Mode PWM Controller
Industry Standard Single-Ended Current Mode PWM Controller
Wifi enabled 8×64  pixel  LED  matrix display
Wifi enabled 8×64 pixel LED matrix display
Arduino Disco Lights
Arduino Disco Lights
PIXIE is an Arduino-based NeoPixel watch
PIXIE is an Arduino-based NeoPixel watch

Top


Shares