Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
haar wavelet transform detect blur , blur estimation

Subject: haar wavelet transform detect blur , blur estimation

From: Sprinceana

Date: 4 May, 2010 17:14:06

Message: 1 of 7

I'm trying to undersant how to compute values for the degree of blury of images.

I found two documents here:

http://lmgtfy.com/?q=detection+for+digital+images+using+wavelet+transform

First pdf

Then I found a document that explains the use of gaussians for first and second derivative.

http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MARBLE/low/edges/canny.htm


I've tried to implement those formulas step by step in a file called haar_wav:

% read and display rgb image
RGB = imread('102.jpg');
imshow(RGB);

% read and display grayscale image

GRAYSCALE = rgb2gray(RGB);
figure,imshow(GRAYSCALE);

% u(x) is the input of type Dirac
% creating a dirac it's 0 for every x=0 and Inf for every x=0


syms a; % to compute a value in an integral it must be declared as symbolic value
a = 5;

x=0:1:100; % 0-initial value, 1 step is increasing the initial value with 1 each time
% 100 is the final value

% equation that describes Dirac impulse

Y=(1/(a*sqrt(pi)))*exp(-x.^2/a^2);

figure, stem(Y) % plot the Dirac impulse each value of the Dirac impulse

% entry of type Dirac impulse property for dirac impulse

 u(x) = int(dirac(x-a)*sin(x),-inf, inf);
 
 r = sqrt(pow(x,2)+pow(y,2)) % r is a parameter that enters in the formula of luminance that I don't know how to implement

 % defining luminance - here is the problem !!! (I(x) =f(x/r) how to add this formula in matlab)

 % edge is modelled as a step function described by this formula

 % A is unknown amplitude, B - pedestal offset
 
modelling_edge = A*u(x)+ B;

% focal_blur_of_edge =

I don't know two things:

A is undefined B is equal to what in the formula of lmgtfy (first pdf) ?

Another question must I defined luminance as I=f(x/r)
where r = sqrt(pow(x,2)+pow(y,2)).

But I don't know how to define I(x) =f(x/r) how I can add this formula to my code?

Thanks in advance for your help!

I attach here my full m file:

http://www.mediafire.com/?mej4mzm33t0


Please I need some guidance I'm sure that somebody experienced this problem in the past. I tried as you can see to start from 0 to implement for an image test called 102.jpg and I'm trying step by step to implement those formulas to obtain the value that represent how blury is my image (a statistical value).

And I have another question:

I must extract the edges using canny operator after applying function rgb2gray.

(this I know to do but just need a confirmation if I must display also the image using canny operator.)

Subject: haar wavelet transform detect blur , blur estimation

From: Sprinceana

Date: 4 May, 2010 17:32:04

Message: 2 of 7

After this line of code:

u(x) = int(dirac(x-a)*sin(x),-inf, inf);

Here are the equations added regarding the link provided with gaussians:

r = sqrt(pow(x,2)+pow(y,2)); % r is a parameter that enter in the luminance formula

fun_gauss = exp[-pow(r,2)/2*pow(sigma,2)]/2*pi*pow(sigma,2);

first_derivative = -r*exp[-pow(r,2)/2*pow(sigma,2)]/2*pi*pow(sigma,4);

second_derivative = -exp[-pow(r,2)/2*pow(sigma,2)]/2*pi*pow(sigma,4)*[1-(r*r/sigma*sigma)]


% then we implement luminance formula after defining r parameter

% I = f(x/r) how to implement this formula in matlab here is my problem!!!!

modelling_edge = A*u(x)+ B;

In have some questions again:

1)

What are the values for x and y that describes r as a circle equation of what I can see. How to set x and y in circle equation.

2)

Then sigma variable what value to assing to it?

3)

And how to explain luminance described by this formula:

I = f(x/r) (is in fact the question for my first post of this reply)

4) Is it good to apply a canny operator after I transformed my test image called 102.jpg into graysscale? (I know how to do this but need an answer of yes or no to add it to the code)

Subject: haar wavelet transform detect blur , blur estimation

From: Sprinceana

Date: 4 May, 2010 17:34:04

Message: 3 of 7

And after computing luminance I must follow the instructions from this link:

http://www.elderlab.yorku.ca/~elder/publications/journals/ElderPAMI98.pdf

Subject: haar wavelet transform detect blur , blur estimation

From: Sprinceana

Date: 4 May, 2010 17:50:19

Message: 4 of 7

Formule de luminance c'est I(x) = f(x/r) comment ecrire cette formule en matlab ?

Subject: haar wavelet transform detect blur , blur estimation

From: Walter Roberson

Date: 4 May, 2010 19:48:27

Message: 5 of 7

Sprinceana wrote:
> Formule de luminance c'est I(x) = f(x/r) comment ecrire cette formule en
> matlab ?

Have you considered using rgb2gray() ? Perhaps in combination with im2double() ?

Subject: haar wavelet transform detect blur , blur estimation

From: Sprinceana

Date: 4 May, 2010 20:25:21

Message: 6 of 7

Walter Roberson <roberson@hushmail.com> wrote in message <hrptmd$9t9$2@canopus.cc.umanitoba.ca>...
> Sprinceana wrote:
> > Formule de luminance c'est I(x) = f(x/r) comment ecrire cette formule en
> > matlab ?
>
> Have you considered using rgb2gray() ? Perhaps in combination with im2double() ?

Sorry for posting in french but I thought that are also people in france on this forum.

No , I must use rgb2gray when converting to a grayscale image not im2double (sorry for posting in both languages).

I'm working on this project from this morning and I have problems of understanding in implementing the formula of luminance. Can someone help me please?

The full m file is attached on mediafire link!

Subject: haar wavelet transform detect blur , blur estimation

From: ImageAnalyst

Date: 5 May, 2010 01:48:01

Message: 7 of 7

Depending on what you mean by luminance (since that's not the correct
term for an image - see http://en.wikipedia.org/wiki/Luminance), you
can find a variety of formulas here:
http://www.easyrgb.com/index.php?X=MATH

Maybe you mean L, L*, V, Y, or I.....

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us