Home »
Public Forums »
archive »
median downsampling
median downsampling [message #29921] |
Wed, 27 March 2002 11:09 |
Jonathan Joseph
Messages: 69 Registered: September 1998
|
Member |
|
|
This is sort of a follow-up to my previous rebin question. I'm having
trouble writing a routine to *efficiently* downsample an 2D array
(ala rebin) but using the median value instead of the average value
over the box (sub-image) being downsampled into a given pixel.
If my downsampling box-size were guaranteed to be the same dimension
in X and Y, I think this problem could be easily solved using the
median routine with a "width" argument. That's not guaranteed to be the
case though, and I can't see how to do a median filter with different
dimensions in X and Y.
I can use methods like those in the astronomy library's boxave.pro to
"quickly" (looping only over the number of pixels in the downsampling
box) reform the 2d array into a 3d array such that A[*,i,j] gives me
all of the pixels from the original image that get downsampled into the
single pixel [i,j] in the output image. Unlike total though, I can't do
a median or sort across a particular dimension of a multi-dimensional
array, so it seems I would still have to do a median operation for each
pixel in the downsampled image.
Can anyone think of a way to achieve the desired result w/o the
large offensive looping?
Perhaps there's a way to do this using histogram (eh JD?)
-Jonathan
|
|
|
Current Time: Wed Oct 08 13:07:38 PDT 2025
Total time taken to generate the page: 0.00520 seconds