Re: Matrix Operations in Mma
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: Matrix Operations in Mma
- From: beau at vision.arc.nasa.gov (Andrew B. Watson)
- Date: Wed, 13 Oct 93 10:06:29 PDT
Following up on
>> How can I assign a matrix to a part of another matrix
A crude solution, used in the context of pasting one image into another.
Note that no error checking is done. "point" is the {row,col} coordinates
of the starting point of the insert.
pasteImage[imagesink_,imagesource_,point_List:{1,1}] :=
Module[{i,rows,cols,irows,icols,row,col},
{irows,icols} = Dimensions[imagesink];
{rows,cols} = Dimensions[imagesource];
{row,col} = point;
Join[
Take[imagesink,row-1],
Table[
Join[Take[imagesink[[i+row-1]],col-1]
,Take[imagesource[[i]],cols]
,Take[imagesink[[i+row-1]],-(icols-cols-col+1)]]
,{i,rows}],
Take[imagesink,-(irows-rows-row+1)]]
]
Andrew B. Watson
MS 262-2 NASA Ames Research Center
Moffett Field CA 94035-1000
(415) 604-5419 -3323 fax
beau at vision.arc.nasa.gov