<< Chapter < Page Chapter >> Page >

Focus detection

Focus Detection:

One important aspect of images is focus. While qualitatively deciding whether an image is in focus or not is relatively easy, quantitatively it can be quite difficult. One way to detect whether or not an image is in focus is by examining its power spectrum.

Power spectrum and focus

It is generally assumed that natural images are made up of fractals, and it can be shown that the power spectrum (power as a function of frequency) of a natural image should fall off as

1 f 2 size 12{ { {1} over {f rSup { size 8{2} } } } } {}

where f is the frequency.

As an image goes out of focus, it becomes blurred. That is to say that the edges are less sharp. If an image contains less sharp edges, its power spectrum will contain less high-frequency power. The power spectrum of an out-of-focus image should, therefore, fall off faster than an in-focus image.

So by calculating the power spectrum and examining its linear regression on a loglog plot (log[power] vs log[frequency]), we can get an indicator of focus.

Calculating the power spectrum

The power specturm is simply the square of the two dimensional Fourier transform:

P k x , k y = F k x , k y 2 size 12{P left (k rSub { size 8{x} } ,k rSub { size 8{y} } right )= lline F left (k rSub { size 8{x} } ,k rSub { size 8{y} } right ) rSup { size 8{2} } rline } {}

where the two dimensional Fourier transform is given by:

F k x , k y = x = 0 N 1 y = 0 N 1 f k x , k y 2 e j2π N xk x + yk y size 12{F left (k rSub { size 8{x} } ,k rSub { size 8{y} } right )= Sum cSub { size 8{x=0} } cSup { size 8{N - 1} } { Sum cSub { size 8{y=0} } cSup { size 8{N - 1} } {f left (k rSub { size 8{x} } ,k rSub { size 8{y} } right ) rSup { size 8{2} } } } e rSup { size 8{ { { - j2π} over {N} } left ( ital "xk" rSub { size 6{x} } + ital "yk" rSub { size 6{y} } right )} } } {}

Note that denotes an individual image pixel. You may have noticed that the above equations define a square image. While a non-symmetric two dimensional Fourier transform exists, using square images eases the process.

Because whether or not an image is in focus depends on the magnitude of power as a function of frequency, once the two dimensional power spectrum is computed as above, we radially average the spectrum. That is, the average of the values which lie on a circle a distance R from the origin is taken. Because frequency increases linearly in all directions from the origin, radially averaging the power spectrum gives the average power at one frequency , effectively collapsing the two dimensional spectrum to one dimension. It should be noted that F k x , k y size 12{F left (k rSub { size 8{x} } ,k rSub { size 8{y} } right )} {} has been centered around baseband, meaning the frequency of the rotionally averaged power spectrum extends from 0 to N/2 -1.

The power spectrum’s falloff on a loglog plot can now be examined to determine focus.

Illustrative example of focus analysis on entire image

The following images show the results of a linear regression of the power spectrum on a loglog plot for an in-focus image and an out-of-focus image.

Focus analysis of an in-focus image

Focus analysis of an out-of-focus image

As expected, the out-of-focus image yielded a linear regression with a slope of -3.3, while the in-focus image yielded a linear regression with a slope of -2.3, indicating that the out-of-focus image has fewer high frequency components.

Determining regions of focus

Because frequency and power should be related exponentially as stated before, the loglog plot should display a linear relationship. Taking the linear regression of the loglog plot leads to an estimate of the frequency fall off. For example, if the linear regression where to return a slope of -2, we know that the power spectrum falls off as 1 f 2 size 12{ { {1} over {f rSup { size 8{2} } } } } {} .

The same principles used to determine whether or not an image is in focus can be used to determine what region of an image is in focus. Because cameras can only focus on one spatial plane, in a single picture certain objects will be more in focus than others. To determine which region of an image is in focus, one simply has to divide the image into separate spatial region and then use the methods described above on each region. The region whose power spectrum conforms most closely to the 1 f 2 size 12{ { {1} over {f rSup { size 8{2} } } } } {} fall off can be considered the center of focus in the image.

Questions & Answers

how does Neisseria cause meningitis
Nyibol Reply
what is microbiologist
Muhammad Reply
what is errata
Muhammad
is the branch of biology that deals with the study of microorganisms.
Ntefuni Reply
What is microbiology
Mercy Reply
studies of microbes
Louisiaste
when we takee the specimen which lumbar,spin,
Ziyad Reply
How bacteria create energy to survive?
Muhamad Reply
Bacteria doesn't produce energy they are dependent upon their substrate in case of lack of nutrients they are able to make spores which helps them to sustain in harsh environments
_Adnan
But not all bacteria make spores, l mean Eukaryotic cells have Mitochondria which acts as powerhouse for them, since bacteria don't have it, what is the substitution for it?
Muhamad
they make spores
Louisiaste
what is sporadic nd endemic, epidemic
Aminu Reply
the significance of food webs for disease transmission
Abreham
food webs brings about an infection as an individual depends on number of diseased foods or carriers dully.
Mark
explain assimilatory nitrate reduction
Esinniobiwa Reply
Assimilatory nitrate reduction is a process that occurs in some microorganisms, such as bacteria and archaea, in which nitrate (NO3-) is reduced to nitrite (NO2-), and then further reduced to ammonia (NH3).
Elkana
This process is called assimilatory nitrate reduction because the nitrogen that is produced is incorporated in the cells of microorganisms where it can be used in the synthesis of amino acids and other nitrogen products
Elkana
Examples of thermophilic organisms
Shu Reply
Give Examples of thermophilic organisms
Shu
advantages of normal Flora to the host
Micheal Reply
Prevent foreign microbes to the host
Abubakar
they provide healthier benefits to their hosts
ayesha
They are friends to host only when Host immune system is strong and become enemies when the host immune system is weakened . very bad relationship!
Mark
what is cell
faisal Reply
cell is the smallest unit of life
Fauziya
cell is the smallest unit of life
Akanni
ok
Innocent
cell is the structural and functional unit of life
Hasan
is the fundamental units of Life
Musa
what are emergency diseases
Micheal Reply
There are nothing like emergency disease but there are some common medical emergency which can occur simultaneously like Bleeding,heart attack,Breathing difficulties,severe pain heart stock.Hope you will get my point .Have a nice day ❣️
_Adnan
define infection ,prevention and control
Innocent
I think infection prevention and control is the avoidance of all things we do that gives out break of infections and promotion of health practices that promote life
Lubega
Heyy Lubega hussein where are u from?
_Adnan
en français
Adama
which site have a normal flora
ESTHER Reply
Many sites of the body have it Skin Nasal cavity Oral cavity Gastro intestinal tract
Safaa
skin
Asiina
skin,Oral,Nasal,GIt
Sadik
How can Commensal can Bacteria change into pathogen?
Sadik
How can Commensal Bacteria change into pathogen?
Sadik
all
Tesfaye
by fussion
Asiina
what are the advantages of normal Flora to the host
Micheal
what are the ways of control and prevention of nosocomial infection in the hospital
Micheal
what is inflammation
Shelly Reply
part of a tissue or an organ being wounded or bruised.
Wilfred
what term is used to name and classify microorganisms?
Micheal Reply
Binomial nomenclature
adeolu
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Adaptive region of interest for video. OpenStax CNX. Dec 14, 2010 Download for free at http://cnx.org/content/col11256/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Adaptive region of interest for video' conversation and receive update notifications?

Ask