though both picture and mask have to be the same size. But of course, yo=
u =
already know that.
On Fri, 22 Feb 2008 12:16:04 -0500, Mario <nospam@yahoo.com> wrote:
> Hi,
> I have a uint8 image and a (logical) mask representing the
> silhouette of a person extracted from the image.
>
> Now I'd want to apply this mask to the image in order to
> view just the person, but with its color.
>
> Is it clear? It's a so stupid question that I'm unable to
> explain it too... :|
> Regards,
>
> Mario
On 2008-02-22 12:48:59 -0500, "Ashish Uthama" <authama@mathworks.com> said:
> Tye the .* operation
>
> man = picture.*mask
>
> though both picture and mask have to be the same size. But of course, yo u
> already know that.
>
> On Fri, 22 Feb 2008 12:16:04 -0500, Mario <nospam@yahoo.com> wrote:
>
>> Hi,
>> I have a uint8 image and a (logical) mask representing the
>> silhouette of a person extracted from the image.
>>
>> Now I'd want to apply this mask to the image in order to
>> view just the person, but with its color.
>>
>> Is it clear? It's a so stupid question that I'm unable to
>> explain it too... :|
>> Regards,
>>
>> Mario
Alternately, you can use logical indexing, e.g.
man(~mask) = 0
"Ashish Uthama" <authama@mathworks.com> wrote in message
<op.t6xs3xlfkk0qo1@uthamaa.dhcp.mathworks.com>...
> Tye the .* operation
>
> man =3D picture.*mask
>
that's what I thought.. but the picture is <480x640x3 uint8>
and mask is <480x640 uint8>
so I tried to do the .* operation between the 3 color
channel (probably there's a faster way, thanks if u can
suggest me..) but, at the end, the image I see is still b&w..
To the best of my knowledge, the above should work.
Not sure why you dont see color with your code
On Mon, 25 Feb 2008 12:48:02 -0500, Mario <nospam@yahoo.com> wrote:
> "Ashish Uthama" <authama@mathworks.com> wrote in message
> <op.t6xs3xlfkk0qo1@uthamaa.dhcp.mathworks.com>...
>> Tye the .* operation
>>
>> man =3D3D picture.*mask
>>
>
> that's what I thought.. but the picture is <480x640x3 uint8>
> and mask is <480x640 uint8>
> so I tried to do the .* operation between the 3 color
> channel (probably there's a faster way, thanks if u can
> suggest me..) but, at the end, the image I see is still b&w..
>
> this is the code
>
> imageR=3Dmask.*picture(:,:,1);
> imageG=3Dmask.*picture(:,:,2);
> imageB=3Dmask.*picture(:,:,3);
> imageRGB=3Dzeros(480,640,3);
> imageRGB(.,:,1)=3DimageR;
> imageRGB(:,:,2)=3DimageG;
> imageRGB(:,:,3)=3DimageB;
> imshow(imageRGB);
>
>
>
On Feb 25, 12:48=A0pm, "Mario " <nos...@yahoo.com> wrote:
> "Ashish Uthama" <auth...@mathworks.com> wrote in message
>
> <op.t6xs3xlfkk0...@uthamaa.dhcp.mathworks.com>...
>
> > Tye the .* operation
>
> > man =3D3D picture.*mask
>
> that's what I thought.. but the picture is <480x640x3 uint8>
> and mask is <480x640 uint8>
> so I tried to do the .* operation between the 3 color
> channel (probably there's a faster way, thanks if u can
> suggest me..) but, at the end, the image I see is still b&w..
>
> this is the code
>
> imageR=3Dmask.*picture(:,:,1);
> imageG=3Dmask.*picture(:,:,2);
> imageB=3Dmask.*picture(:,:,3);
> imageRGB=3Dzeros(480,640,3);
> imageRGB(.,:,1)=3DimageR;
> imageRGB(:,:,2)=3DimageG;
> imageRGB(:,:,3)=3DimageB;
> imshow(imageRGB);
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Mario:
It should work. Try this demo with a standard MATLAB demo image and
let us know if you don't get a masked image that's full color:
Regards,
ImageAnalyst
P.S. You had a syntax error in the line imageRGB(.,:,1)=3DimageR; where
you had a dot instead of a colon.
% Macro to demo masking of color image.
picture=3Dimread('autumn.tif');% Open standard MATLAB demo image.
subplot(2,2,1);
imshow(picture);
title('Original');
mask =3D uint8(picture(:,:,1) < 200); % Get mask of non-sky region
subplot(2,2,2);
imshow(mask, []);
title('Mask');
imageR=3Dmask .* picture(:,:,1);
imageG=3Dmask .* picture(:,:,2);
imageB=3Dmask .* picture(:,:,3);
imageRGB(:,:,1)=3DimageR;
imageRGB(:,:,2)=3DimageG;
imageRGB(:,:,3)=3DimageB;
subplot(2,2,4);
imshow(imageRGB);
title('Sky Masked Out');
ImageAnalyst <imageanalyst@mailinator.com> wrote in message
<f50429ea-c28c-4076-a7c1-ba96c243b83b@n58g2000hsf.googlegroups.com>...
> On Feb 25, 12:48=A0pm, "Mario " <nos...@yahoo.com> wrote:
> > "Ashish Uthama" <auth...@mathworks.com> wrote in message
> >
> > <op.t6xs3xlfkk0...@uthamaa.dhcp.mathworks.com>...
> >
> > > Tye the .* operation
> >
> > > man =3D3D picture.*mask
> >
> > that's what I thought.. but the picture is <480x640x3 uint8>
> > and mask is <480x640 uint8>
> > so I tried to do the .* operation between the 3 color
> > channel (probably there's a faster way, thanks if u can
> > suggest me..) but, at the end, the image I see is still
b&w..
> >
> > this is the code
> >
> > imageR=3Dmask.*picture(:,:,1);
> > imageG=3Dmask.*picture(:,:,2);
> > imageB=3Dmask.*picture(:,:,3);
> > imageRGB=3Dzeros(480,640,3);
> > imageRGB(.,:,1)=3DimageR;
> > imageRGB(:,:,2)=3DimageG;
> > imageRGB(:,:,3)=3DimageB;
> > imshow(imageRGB);
>
>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> Mario:
> It should work. Try this demo with a standard MATLAB demo
image and
> let us know if you don't get a masked image that's full color:
> Regards,
> ImageAnalyst
> P.S. You had a syntax error in the line
imageRGB(.,:,1)=3DimageR; where
> you had a dot instead of a colon.
>
> % Macro to demo masking of color image.
> picture=3Dimread('autumn.tif');% Open standard MATLAB demo
image.
> subplot(2,2,1);
> imshow(picture);
> title('Original');
> mask =3D uint8(picture(:,:,1) < 200); % Get mask of
non-sky region
> subplot(2,2,2);
> imshow(mask, []);
> title('Mask');
> imageR=3Dmask .* picture(:,:,1);
> imageG=3Dmask .* picture(:,:,2);
> imageB=3Dmask .* picture(:,:,3);
> imageRGB(:,:,1)=3DimageR;
> imageRGB(:,:,2)=3DimageG;
> imageRGB(:,:,3)=3DimageB;
> subplot(2,2,4);
> imshow(imageRGB);
> title('Sky Masked Out');
This is to ImageAnalyst
Why do you use the word "3D" everwhere?. It makes the code
and the readable matter so difficult to understand..
Could you please avoid it.
Vihang
On Feb 26, 12:09=A0am, "Vihang Patil" <vihang_pa...@yahoo.com> wrote:
> ImageAnalyst <imageanal...@mailinator.com> wrote in message
>
> <f50429ea-c28c-4076-a7c1-ba96c243b...@n58g2000hsf.googlegroups.com>...
>
>
>
> > On Feb 25, 12:48=3DA0pm, "Mario " <nos...@yahoo.com> wrote:
> > > "Ashish Uthama" <auth...@mathworks.com> wrote in message
>
> > > <op.t6xs3xlfkk0...@uthamaa.dhcp.mathworks.com>...
>
> > > > Tye the .* operation
>
> > > > man =3D3D3D picture.*mask
>
> > > that's what I thought.. but the picture is <480x640x3 uint8>
> > > and mask is <480x640 uint8>
> > > so I tried to do the .* operation between the 3 color
> > > channel (probably there's a faster way, thanks if u can
> > > suggest me..) but, at the end, the image I see is still
> b&w..
>
> > > this is the code
>
> > > imageR=3D3Dmask.*picture(:,:,1);
> > > imageG=3D3Dmask.*picture(:,:,2);
> > > imageB=3D3Dmask.*picture(:,:,3);
> > > imageRGB=3D3Dzeros(480,640,3);
> > > imageRGB(.,:,1)=3D3DimageR;
> > > imageRGB(:,:,2)=3D3DimageG;
> > > imageRGB(:,:,3)=3D3DimageB;
> > > imshow(imageRGB);
>
> =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3=
D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=AD=3D
>
> =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3=
D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D> Mario:
> > It should work. =A0Try this demo with a standard MATLAB demo
> image and
> > let us know if you don't get a masked image that's full color:
> > Regards,
> > ImageAnalyst
> > P.S. You had a syntax error in the line
>
> imageRGB(.,:,1)=3D3DimageR; where
>
>
>
>
>
> > you had a dot instead of a colon.
>
> > % Macro to demo masking of color image.
> > picture=3D3Dimread('autumn.tif');% Open standard MATLAB demo
> image.
> > subplot(2,2,1);
> > imshow(picture);
> > title('Original');
> > mask =3D3D uint8(picture(:,:,1) < 200); % Get mask of
> non-sky region
> > subplot(2,2,2);
> > imshow(mask, []);
> > title('Mask');
> > imageR=3D3Dmask .* picture(:,:,1);
> > imageG=3D3Dmask .* picture(:,:,2);
> > imageB=3D3Dmask .* picture(:,:,3);
> > imageRGB(:,:,1)=3D3DimageR;
> > imageRGB(:,:,2)=3D3DimageG;
> > imageRGB(:,:,3)=3D3DimageB;
> > subplot(2,2,4);
> > imshow(imageRGB);
> > title('Sky Masked Out');
>
> This is to ImageAnalyst
> Why do you use the word "3D" everwhere?. It makes the code
> and the readable matter so difficult to understand..
> Could you please avoid it.
> Vihang- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
----------------------------------------------------------------------------=
------------------------------------
Vihang:
I agree it's annoying. I don't put in a 3D after every equals sign.
In fact when I look up the posts in Google, only your responses to me
have the 3D in them, not mine. I think your news reader has trouble
with equals signs. Also, when you look at other responses to my
messages, such as Ivan's at http://tinyurl.com/3c8gdj
you'll see his newsreader doesn't add any 3D, so maybe it's just you
or your news reader. I put the dividing lines in to separate my
responses from the others. As you know, it can get confusing when
there are so many angle brackets as various levels and people
sometimes respond in the middle of the message rather than all at the
end or beginning. Often it's hard to tell who said what. But for you
I can change from =3D to - so that maybe you won't see the 3D on my
equals signs. I use Google (to read and post) because of the nice
searchable archive integrated in with the newsreader. What news
reader do you use?
Regards,
ImageAnalyst
In article <b3ae8c26-58d4-4d13-a310-21ee04de4570@34g2000hsz.googlegroups.com>,
ImageAnalyst <imageanalyst@mailinator.com> wrote:
>I agree it's annoying. I don't put in a 3D after every equals sign.
>In fact when I look up the posts in Google, only your responses to me
>have the 3D in them, not mine. I think your news reader has trouble
>with equals signs.
No, the problem is at your end. Google groups is using
an encoding of printable-quoted, which converts non-ascii
characters to equal sign followed by two hexidecimal digits;
unfortunately in order to get that to work, the equal sign itself
has to be encoded as equal-sign 3 D (the hex for the equal sign
character.)
Google groups should not be using printable-quoted encoding for
Usenet postings -- MIME is not for use with Usenet (according
to the MIME RFCs.) There is no fault with newsreaders that expect
the standards to be respected.
--
"History is a pile of debris" -- Laurie Anderson
ImageAnalyst <imageanalyst@mailinator.com> wrote in
message <b3ae8c26-58d4-4d13-a310-
21ee04de4570@34g2000hsz.googlegroups.com>...
> On Feb 26, 12:09=A0am, "Vihang Patil"
<vihang_pa...@yahoo.com> wrote:
> > ImageAnalyst <imageanal...@mailinator.com> wrote in
message
> >
> > <f50429ea-c28c-4076-a7c1-
ba96c243b...@n58g2000hsf.googlegroups.com>...
> >
> >
> >
> > > On Feb 25, 12:48=3DA0pm, "Mario " <nos...@yahoo.com>
wrote:
> > > > "Ashish Uthama" <auth...@mathworks.com> wrote in
message
> >
> > > > <op.t6xs3xlfkk0...@uthamaa.dhcp.mathworks.com>...
> >
> > > > > Tye the .* operation
> >
> > > > > man =3D3D3D picture.*mask
> >
> > > > that's what I thought.. but the picture is
<480x640x3 uint8>
> > > > and mask is <480x640 uint8>
> > > > so I tried to do the .* operation between the 3
color
> > > > channel (probably there's a faster way, thanks if
u can
> > > > suggest me..) but, at the end, the image I see is
still
> > b&w..
> >
> > > > this is the code
> >
> > > > imageR=3D3Dmask.*picture(:,:,1);
> > > > imageG=3D3Dmask.*picture(:,:,2);
> > > > imageB=3D3Dmask.*picture(:,:,3);
> > > > imageRGB=3D3Dzeros(480,640,3);
> > > > imageRGB(.,:,1)=3D3DimageR;
> > > > imageRGB(:,:,2)=3D3DimageG;
> > > > imageRGB(:,:,3)=3D3DimageB;
> > > > imshow(imageRGB);
> >
> >
=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3
D=3D3D=3D3D=3D3=
> D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=AD=3D
> >
> >
=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3
D=3D3D=3D3D=3D3=
> D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D> Mario:
> > > It should work. =A0Try this demo with a standard
MATLAB demo
> > image and
> > > let us know if you don't get a masked image that's
full color:
> > > Regards,
> > > ImageAnalyst
> > > P.S. You had a syntax error in the line
> >
> > imageRGB(.,:,1)=3D3DimageR; where
> >
> >
> >
> >
> >
> > > you had a dot instead of a colon.
> >
> > > % Macro to demo masking of color image.
> > > picture=3D3Dimread('autumn.tif');% Open standard
MATLAB demo
> > image.
> > > subplot(2,2,1);
> > > imshow(picture);
> > > title('Original');
> > > mask =3D3D uint8(picture(:,:,1) < 200); % Get mask of
> > non-sky region
> > > subplot(2,2,2);
> > > imshow(mask, []);
> > > title('Mask');
> > > imageR=3D3Dmask .* picture(:,:,1);
> > > imageG=3D3Dmask .* picture(:,:,2);
> > > imageB=3D3Dmask .* picture(:,:,3);
> > > imageRGB(:,:,1)=3D3DimageR;
> > > imageRGB(:,:,2)=3D3DimageG;
> > > imageRGB(:,:,3)=3D3DimageB;
> > > subplot(2,2,4);
> > > imshow(imageRGB);
> > > title('Sky Masked Out');
> >
> > This is to ImageAnalyst
> > Why do you use the word "3D" everwhere?. It makes the
code
> > and the readable matter so difficult to understand..
> > Could you please avoid it.
> > Vihang- Hide quoted text -
> >
> > - Show quoted text -- Hide quoted text -
> >
> > - Show quoted text -
>
> ---------------------------------------------------------
-------------------=
> ------------------------------------
> Vihang:
> I agree it's annoying. I don't put in a 3D after every
equals sign.
> In fact when I look up the posts in Google, only your
responses to me
> have the 3D in them, not mine. I think your news reader
has trouble
> with equals signs. Also, when you look at other
responses to my
> messages, such as Ivan's at
> http://tinyurl.com/3c8gdj
> you'll see his newsreader doesn't add any 3D, so maybe
it's just you
> or your news reader. I put the dividing lines in to
separate my
> responses from the others. As you know, it can get
confusing when
> there are so many angle brackets as various levels and
people
> sometimes respond in the middle of the message rather
than all at the
> end or beginning. Often it's hard to tell who said
what. But for you
> I can change from =3D to - so that maybe you won't see
the 3D on my
> equals signs. I use Google (to read and post) because
of the nice
> searchable archive integrated in with the newsreader.
What news
> reader do you use?
> Regards,
> ImageAnalyst
and I think most of the people out there might also might
be accessing the newsreader from the same location. If you
just click on the link I have posted below, you will see
all your post contains this word "3D" and even though you
give nice suggestions, but because of this "3D" its really
hard to follow. http://www.mathworks.com/matlabcentral/newsreader/search_re
sults?search_string=ImageAnalyst
>and I think most of the people out there might also might
>be accessing the newsreader from the same location.
The statistics I compiled and posted on September 17 2007
showed 69% using the mathworks newsreader, 13.3% using google groups,
and the rest using Usenet.
The statistics would have significantly changed since then, as
I (one of the Useneters) started posting noticably more;
about 10% of the postings these days are from me.
(But I have a *long* way to go to catch up to 'us' or Steve Lord!!)
--
"Tired minds don't plan well. Sleep first, plan later."
-- Walter Reisch
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.