Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!d36g2000prf.googlegroups.com!not-for-mail
From: Richard Brown <rgbrown@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Can nobody help me???
Date: Tue, 11 Nov 2008 13:19:13 -0800 (PST)
Organization: http://groups.google.com
Lines: 36
Message-ID: <25995722-2b6e-4cdc-806a-52c00362f579@d36g2000prf.googlegroups.com>
References: <gfc8tj$4mb$1@aioe.org>
NNTP-Posting-Host: 132.181.20.101
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1226438353 10433 127.0.0.1 (11 Nov 2008 21:19:13 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 11 Nov 2008 21:19:13 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: d36g2000prf.googlegroups.com; posting-host=132.181.20.101; 
	posting-account=5DWgtQoAAADZdTVggSYh0-5t5XsYVHS8
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) 
	Gecko/2008101315 Ubuntu/8.10 (intrepid) Firefox/3.0.3,gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:500294


On Nov 12, 4:38=A0am, Vicky <bonsa...@gmx.de> wrote:
> Hallo there,
>
> this is my code:
>
> image1 =3D imread('image1.bmp');
> image1 =3D im2bw(image1);
> M =3D bwlabel(image1, 8);
> imwrite(M, 'myImage.bmp');
>
> How can I save an image (bmp), so that in each pixel is the element of
> the matrice M?
>
> If I save the matrice M with the command "imwrite" in each pixel of the
> myImage.bmp is an rgb-value. But I don't want a rgb-value, I want the
> label (element) of the matrice M.
>
> How can I realize it?
>
> Please I need help!!!
>
> Best regards,
> Vicky

Hi Vicky

bwlabel creates a matrix of doubles (which imwrite assumes are between
0 and 1). If you convert it to an unsigned integer format, e.g

M =3D uint8(M)  % (or uint16, uint32, etc)

then saving to a bmp will probably give you what you want

cheers,

Richard