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

Home » Public Forums » archive » Faster image median filtering
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
Faster image median filtering [message #76662] Fri, 24 June 2011 06:48 Go to next message
Deckard++; is currently offline  Deckard++;
Messages: 11
Registered: March 2010
Junior Member
Hi,

I am confronted with a performance issue related to median filtering
of images using the median() function of IDL. I have rather extended
sets (several thousands) of 1500x1500 images, and I need to median
filter each of them. So far I have been using this to filter them

img_filtered = median(img, boxsize)

The problem is that it take ~5 seconds per image for boxsize=15, which
is ok for a few images but really time consuming when considering
thousands of images. I have a few questions:

1- is there a way to speed-up median filtering that I am not aware of?
2- do you know if IDL implementation of 2D median() is the most
efficient?
3- if not, are you aware of a DLM that would implement a faster median
filtering of images?

Thank a lot in advance.

Best regards,

-- Arthur;
Re: Faster image median filtering [message #76725 is a reply to message #76662] Tue, 28 June 2011 10:33 Go to previous messageGo to next message
Juggernaut is currently offline  Juggernaut
Messages: 83
Registered: June 2008
Member
On Jun 24, 9:48 am, "Deckard++;" <arthur.vi...@gmail.com> wrote:
> Hi,
>
> I am confronted with a performance issue related to median filtering
> of images using the median() function of IDL. I have rather extended
> sets (several thousands) of 1500x1500 images, and I need to median
> filter each of them. So far I have been using this to filter them
>
> img_filtered = median(img, boxsize)
>
> The problem is that it take ~5 seconds per image for boxsize=15, which
> is ok for a few images but really time consuming when considering
> thousands of images. I have a few questions:
>
> 1- is there a way to speed-up median filtering that I am not aware of?
> 2- do you know if IDL implementation of 2D median() is the most
> efficient?
> 3- if not, are you aware of a DLM that would implement a faster median
> filtering of images?
>
> Thank a lot in advance.
>
> Best regards,
>
>  -- Arthur;

If you have multiple cores on your computer try out the idl_idlbridge
object in IDL and just run multiple instances of your median
processing at once.
Re: Faster image median filtering [message #76753 is a reply to message #76662] Fri, 24 June 2011 15:33 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
I think suspect that the IDL implementation of MEDIAN is reasonably optimal (e.g. using a rolling window). In the ancient days of IDL, MEDIAN() only worked on byte data, and I used to use a CALL_EXTERNAL to a C program for float data. But when support for floating data in MEDIAN was added, it was definitely faster than my CALL_EXTERNAL setup.

Having said that you might look at scaling your data to byte. The MEDIAN() is the midpoint of ordered data , and the order should be maintained after byte scaling (except that resolution is lost, so some nonequal values become equal). And MEDIAN is *much* faster on byte data.

--Wayne
Re: Faster image median filtering [message #76772 is a reply to message #76725] Sun, 03 July 2011 06:53 Go to previous messageGo to next message
Deckard++; is currently offline  Deckard++;
Messages: 11
Registered: March 2010
Junior Member
On Jun 28, 7:33 pm, Bennett <juggernau...@gmail.com> wrote:
> On Jun 24, 9:48 am, "Deckard++;" <arthur.vi...@gmail.com> wrote:
>
>
>
>
>
>> Hi,
>
>> I am confronted with a performance issue related to median filtering
>> of images using the median() function of IDL. I have rather extended
>> sets (several thousands) of 1500x1500 images, and I need to median
>> filter each of them. So far I have been using this to filter them
>
>> img_filtered = median(img, boxsize)
>
>> The problem is that it take ~5 seconds per image for boxsize=15, which
>> is ok for a few images but really time consuming when considering
>> thousands of images. I have a few questions:
>
>> 1- is there a way to speed-up median filtering that I am not aware of?
>> 2- do you know if IDL implementation of 2D median() is the most
>> efficient?
>> 3- if not, are you aware of a DLM that would implement a faster median
>> filtering of images?
>
>> Thank a lot in advance.
>
>> Best regards,
>
>>  -- Arthur;
>
> If you have multiple cores on your computer try out the idl_idlbridge
> object in IDL and just run multiple instances of your median
> processing at once.

This looks really interesting! I had never heard of idl_idlbridge
before. I will look into it because I am running my code on a 16-core
computer. Actually I am quite surprised that the MEDIAN function is
not optimised for multi-core.

Thanks,

-- Arthur;
Re: Faster image median filtering [message #76773 is a reply to message #76753] Sun, 03 July 2011 06:54 Go to previous message
Deckard++; is currently offline  Deckard++;
Messages: 11
Registered: March 2010
Junior Member
On Jun 25, 12:33 am, wlandsman <wlands...@gmail.com> wrote:
> I think suspect that the IDL implementation of MEDIAN is reasonably optimal (e.g. using a rolling window).  In the ancient days of IDL, MEDIAN() only worked on byte data, and I used to use a CALL_EXTERNAL to a C program for float data.    But when support for floating data in MEDIAN was added, it was definitely faster than my CALL_EXTERNAL setup.
>
> Having said that you might look at scaling your data to byte.    The MEDIAN() is the midpoint of ordered data , and the order should be maintained after byte scaling (except that resolution is lost, so some nonequal values become equal).      And MEDIAN is *much* faster on byte data.
>
> --Wayne

Hi Wayne,

scaling my data to byte is not possible I think, but thanks for the
tip.

-- Arthur;
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Problem in creating Postscript of "Transparent Histograms"
Next Topic: Re: map_continents and /fill... revisted

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

Current Time: Wed Oct 08 15:06:22 PDT 2025

Total time taken to generate the page: 0.00617 seconds