Fast local contrast calculations? [message #86294] |
Wed, 23 October 2013 11:28  |
kagoldberg
Messages: 26 Registered: November 2012
|
Junior Member |
|
|
I'm looking for a quick way to calculate local contrast across a (2048,2048) image.
The end result could be a 64x64 element array, for example, and that would be fine.
Speed-wise, calculating local averages with rebin() are lightning fast. Even median(image,N) is pretty fast. But is there a similar high-speed way to get minimum and maximum values within each 'tile' without having to write a loop? It's as though I need a rebin_min() and rebin_max() where the min and max values are preserved within the sampled output array.
I'd love to hear any suggestions. Thanks, Ken
|
|
|
Re: Fast local contrast calculations? [message #86300 is a reply to message #86294] |
Wed, 23 October 2013 22:33   |
Moritz Fischer
Messages: 32 Registered: June 2013
|
Member |
|
|
Hi Ken,
my suggestion is to 'align' the tile elements with reform:
IDL> t = randomn(1, 6,6)
IDL> print, t
IDL> print, max(max( reform( t, 2, 6/2, 2, 6/2 ), D=1),D=2)
You could even remove the second max, by using transpose and another
reform, but I think transpose will cost you...
Let me know what you end up with!
mo
Am 23.10.2013 20:28, schrieb kagoldberg@lbl.gov:
> I'm looking for a quick way to calculate local contrast across a
> (2048,2048) image. The end result could be a 64x64 element array, for
> example, and that would be fine.
>
> Speed-wise, calculating local averages with rebin() are lightning
> fast. Even median(image,N) is pretty fast. But is there a similar
> high-speed way to get minimum and maximum values within each 'tile'
> without having to write a loop? It's as though I need a rebin_min()
> and rebin_max() where the min and max values are preserved within the
> sampled output array.
>
> I'd love to hear any suggestions. Thanks, Ken
>
|
|
|
|