comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Butterworth Band-Pass Filter
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Butterworth Band-Pass Filter [message #73910] Sun, 12 December 2010 09:24 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Oh, right. Good point. In the book I actually
> used a Gaussian high-pass filter, but it should
> have had the same problem. Humm. I'll have to
> look at that more closely. I certainly got
> nice looking output. I wonder why... :-(

Oh, with the Gaussian high-pass filter, the
DIST function is in the numerator, not the
denominator. That's why it worked.

I've GOT to clean up around here before my middle
son returns from Nepal, but maybe I'll have a chance
to work through an example later today.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Butterworth Band-Pass Filter [message #73911 is a reply to message #73910] Sun, 12 December 2010 09:19 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
burton449 writes:

> I dont think you can create a High-Pass filter the way you explain it
> like your last post or like you explain in the article because you
> have the division by 0 error when you put the Dist function in
> denominator... even in your example with dist(248) you have the same
> error...

Oh, right. Good point. In the book I actually
used a Gaussian high-pass filter, but it should
have had the same problem. Humm. I'll have to
look at that more closely. I certainly got
nice looking output. I wonder why... :-(

Well, you could do something like this:

(Dist(s[0],s[1]) > 1e-6)

> Is it possible to have a look at this book? :)

Probably not. My little experiment to make
draft chapters available was a dismal failure.
Lots of people downloaded the chapters, but
only one person sent me any comments. They were
too embarrassed, I guess. :-(

I will be looking for people willing to read the
book and help me find typos and these kind of
errors, though. Probably after the first of the
year. Would you be interested in that?

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Butterworth Band-Pass Filter [message #73912 is a reply to message #73911] Sun, 12 December 2010 09:07 Go to previous messageGo to next message
burton449 is currently offline  burton449
Messages: 15
Registered: December 2010
Junior Member
On Dec 12, 12:02 pm, David Fanning <n...@dfanning.com> wrote:
> burton449 writes:
>> According to your documentation, a high-pass butterworth filter will
>> be defined like that:
>>    filter = 1 / [1 + C(Ro/R)^2n]
>
>> So in IDL, for a cuttoff of 15, and freqImage = FFT(image, -1), the
>> filter will be defined like that:
>>    filter = 1.0 / ( 1.0d + (15.0/freqImage)^2 )
>
>> Is it right?
>
> For what it's worth, I got confused by all this when
> I was reading this article, too, in preparation for
> including this information in my new book. I think I
> explained it better in the book, and I'll probably go
> back and fix this article, too. But not now. I can see
> the end of this book from where I am standing and I am
> at the point where bathing is completely extraneous to
> my purpose! :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")


Is it possible to have a look at this book? :)

I dont think you can create a High-Pass filter the way you explain it
like your last post or like you explain in the article because you
have the division by 0 error when you put the Dist function in
denominator... even in your example with dist(248) you have the same
error...

Max
Re: Butterworth Band-Pass Filter [message #73913 is a reply to message #73912] Sun, 12 December 2010 09:02 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
burton449 writes:

> According to your documentation, a high-pass butterworth filter will
> be defined like that:
> filter = 1 / [1 + C(Ro/R)^2n]
>
> So in IDL, for a cuttoff of 15, and freqImage = FFT(image, -1), the
> filter will be defined like that:
> filter = 1.0 / ( 1.0d + (15.0/freqImage)^2 )
>
> Is it right?

For what it's worth, I got confused by all this when
I was reading this article, too, in preparation for
including this information in my new book. I think I
explained it better in the book, and I'll probably go
back and fix this article, too. But not now. I can see
the end of this book from where I am standing and I am
at the point where bathing is completely extraneous to
my purpose! :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Butterworth Band-Pass Filter [message #73914 is a reply to message #73913] Sun, 12 December 2010 08:56 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
burton449 writes:

> According to your documentation, a high-pass butterworth filter will
> be defined like that:
> filter = 1 / [1 + C(Ro/R)^2n]
>
> So in IDL, for a cuttoff of 15, and freqImage = FFT(image, -1), the
> filter will be defined like that:
> filter = 1.0 / ( 1.0d + (15.0/freqImage)^2 )
>
> Is it right?

No, what you are calling freqImage is called freqDomainImage
in that example. What you want is something like this:

s = Size(image, /Dimensions)
filter = 1.0D / (1.0D + 15.0/Dist(s[0],s[1]))^2)

In other words, what you are calling "freqImage" in
the filter is actually built with the DIST function,
and is different from the freqDomainImage, which is
defined like this:

freqDomainImage = FFT(image, -1)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Butterworth Band-Pass Filter [message #73915 is a reply to message #73914] Sun, 12 December 2010 08:29 Go to previous messageGo to next message
burton449 is currently offline  burton449
Messages: 15
Registered: December 2010
Junior Member
On Dec 11, 11:37 pm, David Fanning <n...@dfanning.com> wrote:
> burton449 writes:
>> as mentionned in the topic, i want to do a Butterworth Band-Pass
>> Filter on a 9166 X 4600 pixels image.
>
>> The doc of butterworth.pro in the astrolib explain how to use the
>> script for a lowpass filter, but not for a band-pass and a high-pass.
>
>> Have any idea how to do?
>
> You need to read my new book. In the meantime, you
> can find an explanation here:
>
>   http://www.dfanning.com/ip_tips/freqfiltering.html
>
> This describes a low-pass filter, but the equation for
> the high-pass filter is there, too. Just replace the
> low-pass filter with the high-pass version. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Thank you again David for your help,

According to your documentation, a high-pass butterworth filter will
be defined like that:
filter = 1 / [1 + C(Ro/R)^2n]

So in IDL, for a cuttoff of 15, and freqImage = FFT(image, -1), the
filter will be defined like that:
filter = 1.0 / ( 1.0d + (15.0/freqImage)^2 )

Is it right?
Thanks again
Max
Re: Butterworth Band-Pass Filter [message #73917 is a reply to message #73915] Sat, 11 December 2010 20:37 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
burton449 writes:

> as mentionned in the topic, i want to do a Butterworth Band-Pass
> Filter on a 9166 X 4600 pixels image.
>
> The doc of butterworth.pro in the astrolib explain how to use the
> script for a lowpass filter, but not for a band-pass and a high-pass.
>
> Have any idea how to do?

You need to read my new book. In the meantime, you
can find an explanation here:

http://www.dfanning.com/ip_tips/freqfiltering.html

This describes a low-pass filter, but the equation for
the high-pass filter is there, too. Just replace the
low-pass filter with the high-pass version. :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Butterworth Band-Pass Filter [message #74009 is a reply to message #73911] Sun, 12 December 2010 09:28 Go to previous messageGo to next message
burton449 is currently offline  burton449
Messages: 15
Registered: December 2010
Junior Member
On Dec 12, 12:19 pm, David Fanning <n...@dfanning.com> wrote:
> burton449 writes:
>> I dont think you can create a High-Pass filter the way you explain it
>> like your last post or like you explain in the article because you
>> have the division by 0 error when you put the Dist function in
>> denominator... even in your example with dist(248) you have the same
>> error...
>
> Oh, right. Good point. In the book I actually
> used a Gaussian high-pass filter, but it should
> have had the same problem. Humm. I'll have to
> look at that more closely. I certainly got
> nice looking output. I wonder why... :-(
>
> Well, you could do something like this:
>
>    (Dist(s[0],s[1]) > 1e-6)
>
>> Is it possible to have a look at this book? :)
>
> Probably not. My little experiment to make
> draft chapters available was a dismal failure.
> Lots of people downloaded the chapters, but
> only one person sent me any comments. They were
> too embarrassed, I guess. :-(
>
> I will be looking for people willing to read the
> book and help me find typos and these kind of
> errors, though. Probably after the first of the
> year. Would you be interested in that?
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Of course that I am interested! The timing is perfect because I will
have one or two months off after the first of the year, and I would
like to spend some time learning more IDL. Im not expert but I can
test your examples of some chapters if you like.

Max
Re: Butterworth Band-Pass Filter [message #84608 is a reply to message #73911] Sun, 12 December 2010 09:30 Go to previous message
burton449 is currently offline  burton449
Messages: 15
Registered: December 2010
Junior Member
On Dec 12, 12:19 pm, David Fanning <n...@dfanning.com> wrote:
> burton449 writes:
>> I dont think you can create a High-Pass filter the way you explain it
>> like your last post or like you explain in the article because you
>> have the division by 0 error when you put the Dist function in
>> denominator... even in your example with dist(248) you have the same
>> error...
>
> Oh, right. Good point. In the book I actually
> used a Gaussian high-pass filter, but it should
> have had the same problem. Humm. I'll have to
> look at that more closely. I certainly got
> nice looking output. I wonder why... :-(
>
> Well, you could do something like this:
>
>    (Dist(s[0],s[1]) > 1e-6)
>
>> Is it possible to have a look at this book? :)
>
> Probably not. My little experiment to make
> draft chapters available was a dismal failure.
> Lots of people downloaded the chapters, but
> only one person sent me any comments. They were
> too embarrassed, I guess. :-(
>
> I will be looking for people willing to read the
> book and help me find typos and these kind of
> errors, though. Probably after the first of the
> year. Would you be interested in that?
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Of course that I am interested! The timing is perfect because I will
have one or two months off after the first of the year, and I would
like to spend some time learning more IDL. Im not expert but I can
test your examples of some chapters if you like.

Max
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Over-PLOT() on MAP()?
Next Topic: Run envi routine in IDL Virtual MAchine

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:04:02 PDT 2025

Total time taken to generate the page: 0.00798 seconds