# image filtering using bessel function/filters

Started by April 10, 2007
```Hi,

I have been asked to design a program in Matlab which calculates the FFT
of an image, then defocus the image using a Bessel filter, and reconstruct
the defocussed image. Now, I find that only analog models of Bessel filters
are available in Matlab, though i found a link to a pdf which shows values
of the coefficients upto order 10. But, how do i construct a 2D-Bessel
Digital filter?

I also read the posts which say that symmetric FIR filters outwit digital
counterparts of bessel filters, but I would have to put that suggestion
yet, to get to know if i can carry on with that design. So, until then, I
have to finish designing this 2D-Bessel Filter.

thanks,
cedance.

_____________________________________
Do you know a company who employs DSP engineers?
Is it already listed at http://dsprelated.com/employers.php ?
```
```On Apr 10, 7:33 am, "cedance" <aragorn1...@gmail.com> wrote:
> Hi,
>
> I have been asked to design a program in Matlab which calculates the FFT
> of an image, then defocus the image using a Bessel filter, and reconstruct
> the defocussed image. Now, I find that only analog models of Bessel filters
> are available in Matlab, though i found a link to a pdf which shows values
> of the coefficients upto order 10. But, how do i construct a 2D-Bessel
> Digital filter?
>
> I also read the posts which say that symmetric FIR filters outwit digital
> counterparts of bessel filters, but I would have to put that suggestion
> yet, to get to know if i can carry on with that design. So, until then, I
> have to finish designing this 2D-Bessel Filter.
>
>
> thanks,
> cedance.
>
Hello Cedance,

What you want is a polar form where your radial equation is a bessel
function. If you are doing something akin to diffraction through a
circular aperture, then you need J1(r) (Bessel's fuction of 1st
order). Hence for each (x,y) then compute J1(a*sqrt(x^2+y^2) where "a"
is a simple scaling factor.

IHTH,

Clay

```
```On 10 Apr, 13:33, "cedance" <aragorn1...@gmail.com> wrote:
> Hi,
>
> I have been asked to design a program in Matlab which calculates the FFT
> of an image, then defocus the image using a Bessel filter, and reconstruct
> the defocussed image. Now, I find that only analog models of Bessel filters
> are available in Matlab, though i found a link to a pdf which shows values
> of the coefficients upto order 10. But, how do i construct a 2D-Bessel
> Digital filter?

These are two questions:

1) How to design a digital domain filter from analog prototype
2) How to make a 2D digital filter form a 1D digital prototype

The answer to the first question is generally along the lines

- Get the spec in discrete-time (DT) domain
- Transform the spec to contiouous-time (CT) domain
- Desing an analog filter which meets the CT spec
- Transform the analog prtotype from CT to DT using
e.g. the Bilinear Transform (BLT)
- Tidy up whatever details might remain.

It's a lot of work, and is a very eductaional excercise,
but might not be exactly what you need. So I'll leave the
details for now.

The second question is a bit easier.

Once you have the magnitude response of the 1D filter,
you make a circular symmetric version in 2D spectrum
domain. You could either use the filter as is in 2D
spectrum domain, or IFFT it back to 2D spatial domain
to use it as a convolution mask.

The main quirky issue with this approach is that you
need to re-sample from polar 2D spectrum coordinates to
carthesian 2D spectrum coordinates.

And yes, the spectrum phase is left unspecified.
Which may or may not be a problem.

Rune

```
```Rune Allnor wrote:
> On 10 Apr, 13:33, "cedance" <aragorn1...@gmail.com> wrote:
>> Hi,
>>
>> I have been asked to design a program in Matlab which calculates the FFT
>> of an image, then defocus the image using a Bessel filter, and reconstruct
>> the defocussed image. Now, I find that only analog models of Bessel filters
>> are available in Matlab, though i found a link to a pdf which shows values
>> of the coefficients upto order 10. But, how do i construct a 2D-Bessel
>> Digital filter?
>
> These are two questions:
>
> 1) How to design a digital domain filter from analog prototype
> 2) How to make a 2D digital filter form a 1D digital prototype

Another question is "What does the assignment really mean?" We EEs know
Bessel filters as a particular class with particular useful properties.
The effect of diffraction on an image, as if it had been created with a
small aperture, is that of a low-pass filter whose radial response curve
has the shape of a Bessel function (J1?). That is quite another matter.
I can imagine someone familiar with the mathematics of optics but not
with the lingo of filtering could pose the problem in a misleading way.

...

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```>On Apr 10, 7:33 am, "cedance" <aragorn1...@gmail.com> wrote:
>> Hi,
>>
>> I have been asked to design a program in Matlab which calculates the
FFT
>> of an image, then defocus the image using a Bessel filter, and
reconstruct
>> the defocussed image. Now, I find that only analog models of Bessel
filters
>> are available in Matlab, though i found a link to a pdf which shows
values
>> of the coefficients upto order 10. But, how do i construct a 2D-Bessel
>> Digital filter?
>>
>> I also read the posts which say that symmetric FIR filters outwit
digital
>> counterparts of bessel filters, but I would have to put that
suggestion
>> yet, to get to know if i can carry on with that design. So, until then,
I
>> have to finish designing this 2D-Bessel Filter.
>>
>>
>> thanks,
>> cedance.
>>
>Hello Cedance,
>
>What you want is a polar form where your radial equation is a bessel
>function. If you are doing something akin to diffraction through a
>circular aperture, then you need J1(r) (Bessel's fuction of 1st
>order). Hence for each (x,y) then compute J1(a*sqrt(x^2+y^2) where "a"
>is a simple scaling factor.
>
>IHTH,
>
>Clay
>
>
>

Hi Clay,

Thanks for your reply. I understand you have a good understanding abt
this. However, i would really need a detailed explanation as to how to go
about. I have not worked with bessel functions before!!! I wouldnt say its
difficult, with Matlab. But however, can you give a detailed explanation!
If any...

many thanks,
cedance.

_____________________________________
Do you know a company who employs DSP engineers?
Is it already listed at http://dsprelated.com/employers.php ?
```
```>Rune Allnor wrote:
>> On 10 Apr, 13:33, "cedance" <aragorn1...@gmail.com> wrote:
>>> Hi,
>>>
>>> I have been asked to design a program in Matlab which calculates the
FFT
>>> of an image, then defocus the image using a Bessel filter, and
reconstruct
>>> the defocussed image. Now, I find that only analog models of Bessel
filters
>>> are available in Matlab, though i found a link to a pdf which shows
values
>>> of the coefficients upto order 10. But, how do i construct a
2D-Bessel
>>> Digital filter?
>>
>> These are two questions:
>>
>> 1) How to design a digital domain filter from analog prototype
>> 2) How to make a 2D digital filter form a 1D digital prototype
>
>Another question is "What does the assignment really mean?" We EEs know
>Bessel filters as a particular class with particular useful properties.
>The effect of diffraction on an image, as if it had been created with a
>small aperture, is that of a low-pass filter whose radial response curve

>has the shape of a Bessel function (J1?). That is quite another matter.
>I can imagine someone familiar with the mathematics of optics but not
>with the lingo of filtering could pose the problem in a misleading way.
>
>   ...
>
>Jerry
>--
>Engineering is the art of making what you want from things you can get.
>&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
>

Hi Jerry,

Actually, this is in fact a project related to Optics. The bessel function
i am to use is for defocussing the image as i had previously mentioned.
Pardon me if i have confused with my own thoughts, as to how to go about.
I think the previous reply i got is how i should go about, but still a
detailed explanation or a link would be highly useful.

thanks a lot,
cedance.

_____________________________________
Do you know a company who employs DSP engineers?
Is it already listed at http://dsprelated.com/employers.php ?
```
```On 10 Apr, 17:11, "cedance" <aragorn1...@gmail.com> wrote:

> >I can imagine someone familiar with the mathematics of optics but not
> >with the lingo of filtering could pose the problem in a misleading way.
...
> Actually, this is in fact a project related to Optics.

It seems you are trying to simulate some physical effects of
some optics system, then.

If this is indeed the case, you have come to the wrong forum.
You would probably need to consult people who know modeling
of optical systems, to achive exactly the effect you want.
The term "bessel filter" makes sense both in DSP and optics,
but mean different things.

You might want to get back to your boss or supervisor and
explain ti him or her that you have found the term "Bessel
filter" in the context of DSP, and is confused as to whether
this is what you want.

You will then get directions for exactly where to look for

Rune

```
```>On 10 Apr, 17:11, "cedance" <aragorn1...@gmail.com> wrote:
>
>> >I can imagine someone familiar with the mathematics of optics but not
>> >with the lingo of filtering could pose the problem in a misleading
way.
>...
>> Actually, this is in fact a project related to Optics.
>
>It seems you are trying to simulate some physical effects of
>some optics system, then.
>
>If this is indeed the case, you have come to the wrong forum.
>You would probably need to consult people who know modeling
>of optical systems, to achive exactly the effect you want.
>The term "bessel filter" makes sense both in DSP and optics,
>but mean different things.
>
>You might want to get back to your boss or supervisor and
>explain ti him or her that you have found the term "Bessel
>filter" in the context of DSP, and is confused as to whether
>this is what you want.
>
>You will then get directions for exactly where to look for
>
>Rune
>
>

Hi Rune,

It is difficult to explain on what regard, the project is. Its something
related to the human eye, its functioning/behavior to "DEFOCUS". Its well
known that bessel filter is a smoothening filter used in measuring the
amount or depth of defocus. I think you ppl might be aware of bessel
filters used to correct teh images where image is blurred as a result of
defocus.

In this regard alone, i need the help, and i fail to see how it is
irrelevant to filtering. I need to apply the filter to defocus the image.
My professor has told me to take the fft of the image and then multiply
with the filter and reconstruct the image, the IFFT namely. So, I think I
have come to the right forum???

Also, I think the reply Clay gave was more or less the idea i am wanting.
I am waiting for his reply. Anyways, If you still feel its irrelevant,
then I would just wait for the reply from Clay, if any and then decide.

thanks a lot,
cedance.

_____________________________________
Do you know a company who employs DSP engineers?
Is it already listed at http://dsprelated.com/employers.php ?
```
```On Apr 10, 11:05 am, "cedance" <aragorn1...@gmail.com> wrote:
> >On Apr 10, 7:33 am, "cedance" <aragorn1...@gmail.com> wrote:
> >> Hi,
>
> >> I have been asked to design a program in Matlab which calculates the
> FFT
> >> of an image, then defocus the image using a Bessel filter, and
> reconstruct
> >> the defocussed image. Now, I find that only analog models of Bessel
> filters
> >> are available in Matlab, though i found a link to a pdf which shows
> values
> >> of the coefficients upto order 10. But, how do i construct a 2D-Bessel
> >> Digital filter?
>
> >> I also read the posts which say that symmetric FIR filters outwit
> digital
> >> counterparts of bessel filters, but I would have to put that
> suggestion
> >> yet, to get to know if i can carry on with that design. So, until then,
> I
> >> have to finish designing this 2D-Bessel Filter.
>
>
> >> thanks,
> >> cedance.
>
> >Hello Cedance,
>
> >What you want is a polar form where your radial equation is a bessel
> >function. If you are doing something akin to diffraction through a
> >circular aperture, then you need J1(r) (Bessel's fuction of 1st
> >order). Hence for each (x,y) then compute J1(a*sqrt(x^2+y^2) where "a"
> >is a simple scaling factor.
>
> >IHTH,
>
> >Clay
>
> Hi Clay,
>
> Thanks for your reply. I understand you have a good understanding abt
> this. However, i would really need a detailed explanation as to how to go
> about. I have not worked with bessel functions before!!! I wouldnt say its
> difficult, with Matlab. But however, can you give a detailed explanation!
> If any...
>
> many thanks,
> cedance.
>

Hello Cedance,

The form you need for the radial function is J1(a*r)/(a*r) (I left
that last part (denominator term) out of my earlier response)

Basically what is going on is your blurring is the computing of a
blurred pixel as the average of all pixels in a circular regoin
surrounding your pixel. So what is the fourier transform of a circular
aperture? It is the bessel filter with H(r,theta) = J1(ar)/(ar). An
ideal lowpass filter in this case would put the 1st zero of J1()
(which is at 1.21966*pi) on top of the neighboring pixel. The "a" is
the scaling (blurring) factor in this case.

So by blurring the picture by using an FFT, you are instead of
convolving the original image with circular apertures, you are
converting over to spatial frequencies and multiplying the picture
with the bessel filter and then converting back. To get an idea of
what your bessel filter will look like, try looking up Airy discs.

IHTH,

Clay

```
```cedance wrote:
>> On 10 Apr, 17:11, "cedance" <aragorn1...@gmail.com> wrote:
>>
>>>> I can imagine someone familiar with the mathematics of optics but not
>>>> with the lingo of filtering could pose the problem in a misleading
> way.
>> ...
>>> Actually, this is in fact a project related to Optics.
>> It seems you are trying to simulate some physical effects of
>> some optics system, then.
>>
>> If this is indeed the case, you have come to the wrong forum.
>> You would probably need to consult people who know modeling
>> of optical systems, to achive exactly the effect you want.
>> The term "bessel filter" makes sense both in DSP and optics,
>> but mean different things.
>>
>> You might want to get back to your boss or supervisor and
>> explain ti him or her that you have found the term "Bessel
>> filter" in the context of DSP, and is confused as to whether
>> this is what you want.
>>
>> You will then get directions for exactly where to look for
>> material relevant to your application.
>>
>> Rune
>>
>>
>
> Hi Rune,
>
> It is difficult to explain on what regard, the project is. Its something
> related to the human eye, its functioning/behavior to "DEFOCUS". Its well
> known that bessel filter is a smoothening filter used in measuring the
> amount or depth of defocus. I think you ppl might be aware of bessel
> filters used to correct teh images where image is blurred as a result of
> defocus.
>
> In this regard alone, i need the help, and i fail to see how it is
> irrelevant to filtering. I need to apply the filter to defocus the image.
> My professor has told me to take the fft of the image and then multiply
> with the filter and reconstruct the image, the IFFT namely. So, I think I
> have come to the right forum???
>
> Also, I think the reply Clay gave was more or less the idea i am wanting.
> I am waiting for his reply. Anyways, If you still feel its irrelevant,
> then I would just wait for the reply from Clay, if any and then decide.
>
> thanks a lot,
> cedance.

Clay has set you on the right path. It is now clear that you want a
filter with the shape of a Bessel function. In signal processing, a
Bessel filter has maximally flat delay vs. frequency. It gets its name
from the use of Bessel functions to compute the component values. It's
not at all the same thing. http://en.wikipedia.org/wiki/Bessel_filter

I am puzzled by what I see as a conflict between the requirement --
Bessel shape indicating a diffraction process -- and your using the term
"defocus". The two kinds of blurring are only superficially the same.

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```