From: Z A on
Hello walter,

Thank you kindly for your reply. I am invoking the following
http://blogs.mathworks.com/steve/2009/02/18/image-overlay-using-transparency/
from steve's blog, and following his method I get that x 9 matrix, which is confusing me alot.
Tha x 9 image is the green image you see in his blog.

Best
Z

Walter Roberson <roberson(a)hushmail.com> wrote in message <YDWHn.12979$TL5.6183(a)newsfe24.iad>...
> Z A wrote:
> > I tried reshape however I get an error, obviously because I want a M x N
> > x 3 and so I will not hav ethe same elements.
> > This is what I want:
> > I have an image which is composed of 420 x 560 x 3 unit8, I can do
> > womething like rgb2gray to get 420 x 560 double. However my second image
> > is 420 x 560 x 9, I cannot overlay that as a transperency onto the first
> > one, because the dimensions are different, what I want is to change that
> > matrix to 420 x 560 x 3 so I can do that without losing any info.
>
> The first image is x 3 because it is a true-color image, with the third
> dimension being red, green, and blue.
>
> The second image... x 9 is either a mistake or an indication that it is
> really 9 grayscale or indexed images stacked together.
>
> The only way to pack down a 420 x 560 x 9 matrix to 420 x 560 x 3 matrix
> without losing any information is by representing the information
> differently, such as
>
> new(:,:,1) = old(:,:,1) * 65536 + old(:,:,2) * 256 + old(:,:,3);
> new(:,:,2) = old(:,:,4) * 65536 + old(:,:,5) * 256 + old(:,:,6);
>
> and so on.
>
> However, data packet in such a manner would not be suitable for use as a
> transparency.
>
> You are going to have to explore _why_ the second image is x 9; it is
> fairly unlikely that it represents a single image.
From: Walter Roberson on
Z A wrote:
> Hello walter,
>
> Thank you kindly for your reply. I am invoking the following
> http://blogs.mathworks.com/steve/2009/02/18/image-overlay-using-transparency/
>
> from steve's blog, and following his method I get that x 9 matrix, which
> is confusing me alot.
> Tha x 9 image is the green image you see in his blog.

S1 = size(E,1);
S2 = size(E,2);
green = cat(3, zeros(S1,S2), ones(S1,S2), zeros(S1,S2));
From: ImageAnalyst on
The green image is a true color N by M by 3 image. There is no 9
plane image. Read his explanation again carefully. He had an N by M
image, then he locked that down with "hold on" and put a N by M by 3
green image on top of it, essentially covering up the monochrome
image. Then he used a different N by M image to modify the
transparency of the green image which was sitting on top of the
monochrome image, thus letting the monochrome image show through in
some parts.