From: Pinpress on 17 Apr 2010 11:52 Hi, I know I can put multiple images as "layers" in Photoshop, and then set the transparent value for each layer so that I can have a "fused" composite image. I just wonder how I can achieve the same from within Matlab (because these images are obtained in Matlab in the first place). Any good way to do this? Thanks very much.
From: Walter Roberson on 17 Apr 2010 12:24 Pinpress wrote: > I know I can put multiple images as "layers" in Photoshop, and then set > the transparent value for each layer so that I can have a "fused" > composite image. I just wonder how I can achieve the same from within > Matlab (because these images are obtained in Matlab in the first place). > Any good way to do this? The code is pretty simple: compimage = zeros(size(layers(:,:,:,1)); for L = 1:size(layers,4) compimage = compimage * (1-alpha(L)) + alpha(L) * layers(:,:,:,L); end You can optimize this a bit in some cases: if alpha is 1 for any layer, then all layers below that will be invisible, so you can search for the last alpha == 1 and use that layer as your initial compimage and only process the things above that. Also, you can skip processing any layer which has an alpha 0 as it will not add anything to the image.
|
Pages: 1 Prev: getting a grey image after cropping Next: GUI tool for image volume browser |