View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Median of lines in a 2D image to produce a 1D vector.

Frank Valdes wrote on Jan 14, 2000

Q:  How do I median a bunch of lines in an image and output it to a 1-D image?


A:  This operation really should be an option in BLKAVG.  Currently it
only allows summing and averaging over rows (or columns).  The way
to do it is as follows.  Suppose you have an image foo which is 2048x500.
You want the median of lines 240 to 260.

cl> median foo[*,240:260] foomed2d 1 21
cl> imcopy foomed2d[*,11] foomed1d
cl> imdel foomed2d

The first step selects the lines to be medianed with an image section
(you could do the whole image but why bother) and uses a box median
which is 1 along the direction you don't want a median and the number
of lines in the other direction.  This produces a 2D image where the
center is the full median and at the edges it is a partial median
because of the moving box.  The second step is used to extract the
desired 1D median vector.  The last step is to get rid of the temporary
image.

Last post on Jan 14, 2000