View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

interleaving images

Frank Valdes wrote on Apr 02, 2003

Q:  I am looking for a quick and convenient way of interleaving
the rows from two images (to create a single image twice as high).
Currently I have a short script which creates a new image double the
size and then uses imcopy to copy a row from each image alternately to
the new image.
This is rather inefficient and takes a long time.
Do you know if there is there a quicker way?


A:  Thank you for an interesting question.  This could be a challenge
puzzle to IRAF users.  The way I suggest you do this is with BLKREP and
IMEXPR.  First block replicate the images so that each line appears
twice.  Then use the expression shown below which copes a line from the
first image if the line number is odd and from the second if it is
even.  The variable J is a special feature in IMEXPR which refers to
the current line.

cl> blkrep image1,image2 temp1,temp2 1 2
cl> imexpr "(mod(J,2)==1) ? a : b" out temp1 temp2
cl> imdel temp1,temp2

Last post on Apr 02, 2003