<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239054</link>
    <title>MATLAB Central Newsreader - Can nobody help me???</title>
    <description>Feed for thread: Can nobody help me???</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 11 Nov 2008 15:38:20 -0500</pubDate>
      <title>Can nobody help me???</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239054#610310</link>
      <author>Vicky</author>
      <description>Hallo there,&lt;br&gt;
&lt;br&gt;
this is my code:&lt;br&gt;
&lt;br&gt;
image1 = imread('image1.bmp');&lt;br&gt;
image1 = im2bw(image1);&lt;br&gt;
M = bwlabel(image1, 8);&lt;br&gt;
imwrite(M, 'myImage.bmp');&lt;br&gt;
&lt;br&gt;
How can I save an image (bmp), so that in each pixel is the element of &lt;br&gt;
the matrice M?&lt;br&gt;
&lt;br&gt;
If I save the matrice M with the command &quot;imwrite&quot; in each pixel of the &lt;br&gt;
myImage.bmp is an rgb-value. But I don't want a rgb-value, I want the &lt;br&gt;
label (element) of the matrice M.&lt;br&gt;
&lt;br&gt;
How can I realize it?&lt;br&gt;
&lt;br&gt;
Please I need help!!!&lt;br&gt;
&lt;br&gt;
Best regards,&lt;br&gt;
Vicky</description>
    </item>
    <item>
      <pubDate>Tue, 11 Nov 2008 15:53:02 -0500</pubDate>
      <title>Re: Can nobody help me???</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239054#610315</link>
      <author>David </author>
      <description>Vicky &amp;lt;bonsai19@gmx.de&amp;gt; wrote in message &amp;lt;gfc8tj$4mb$1@aioe.org&amp;gt;...&lt;br&gt;
&amp;gt; Hallo there,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; this is my code:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; image1 = imread('image1.bmp');&lt;br&gt;
&amp;gt; image1 = im2bw(image1);&lt;br&gt;
&amp;gt; M = bwlabel(image1, 8);&lt;br&gt;
&amp;gt; imwrite(M, 'myImage.bmp');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; How can I save an image (bmp), so that in each pixel is the element of &lt;br&gt;
&amp;gt; the matrice M?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If I save the matrice M with the command &quot;imwrite&quot; in each pixel of the &lt;br&gt;
&amp;gt; myImage.bmp is an rgb-value. But I don't want a rgb-value, I want the &lt;br&gt;
&amp;gt; label (element) of the matrice M.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; How can I realize it?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Please I need help!!!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Best regards,&lt;br&gt;
&amp;gt; Vicky&lt;br&gt;
&lt;br&gt;
well, a bmp file is normally a simple rgb format.  read the help for imwrite and see if one of the other formats may be better for what you want.  or you may just want to save M to something else, like a mat file instead of as an image.</description>
    </item>
    <item>
      <pubDate>Tue, 11 Nov 2008 15:57:41 -0500</pubDate>
      <title>Re: Can nobody help me???</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239054#610320</link>
      <author>Adam Chapman</author>
      <description>On Nov 11, 3:53=A0pm, &quot;David&quot; &amp;lt;d...@bigcompany.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Vicky &amp;lt;bonsa...@gmx.de&amp;gt; wrote in message &amp;lt;gfc8tj$4m...@aioe.org&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hallo there,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; this is my code:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; image1 =3D imread('image1.bmp');&lt;br&gt;
&amp;gt; &amp;gt; image1 =3D im2bw(image1);&lt;br&gt;
&amp;gt; &amp;gt; M =3D bwlabel(image1, 8);&lt;br&gt;
&amp;gt; &amp;gt; imwrite(M, 'myImage.bmp');&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; How can I save an image (bmp), so that in each pixel is the element of&lt;br&gt;
&amp;gt; &amp;gt; the matrice M?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; If I save the matrice M with the command &quot;imwrite&quot; in each pixel of the&lt;br&gt;
&amp;gt; &amp;gt; myImage.bmp is an rgb-value. But I don't want a rgb-value, I want the&lt;br&gt;
&amp;gt; &amp;gt; label (element) of the matrice M.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; How can I realize it?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Please I need help!!!&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Best regards,&lt;br&gt;
&amp;gt; &amp;gt; Vicky&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; well, a bmp file is normally a simple rgb format. =A0read the help for im=&lt;br&gt;
write and see if one of the other formats may be better for what you want. =&lt;br&gt;
=A0or you may just want to save M to something else, like a mat file instea=&lt;br&gt;
d of as an image.- Hide quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; - Show quoted text -&lt;br&gt;
&lt;br&gt;
Use the &quot;save&quot; command, and save the variable M in a .mat file</description>
    </item>
    <item>
      <pubDate>Tue, 11 Nov 2008 21:19:13 -0500</pubDate>
      <title>Re: Can nobody help me???</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239054#610370</link>
      <author>Richard Brown</author>
      <description>On Nov 12, 4:38=A0am, Vicky &amp;lt;bonsa...@gmx.de&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hallo there,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; this is my code:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; image1 =3D imread('image1.bmp');&lt;br&gt;
&amp;gt; image1 =3D im2bw(image1);&lt;br&gt;
&amp;gt; M =3D bwlabel(image1, 8);&lt;br&gt;
&amp;gt; imwrite(M, 'myImage.bmp');&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; How can I save an image (bmp), so that in each pixel is the element of&lt;br&gt;
&amp;gt; the matrice M?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; If I save the matrice M with the command &quot;imwrite&quot; in each pixel of the&lt;br&gt;
&amp;gt; myImage.bmp is an rgb-value. But I don't want a rgb-value, I want the&lt;br&gt;
&amp;gt; label (element) of the matrice M.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; How can I realize it?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Please I need help!!!&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Best regards,&lt;br&gt;
&amp;gt; Vicky&lt;br&gt;
&lt;br&gt;
Hi Vicky&lt;br&gt;
&lt;br&gt;
bwlabel creates a matrix of doubles (which imwrite assumes are between&lt;br&gt;
0 and 1). If you convert it to an unsigned integer format, e.g&lt;br&gt;
&lt;br&gt;
M =3D uint8(M)  % (or uint16, uint32, etc)&lt;br&gt;
&lt;br&gt;
then saving to a bmp will probably give you what you want&lt;br&gt;
&lt;br&gt;
cheers,&lt;br&gt;
&lt;br&gt;
Richard</description>
    </item>
    <item>
      <pubDate>Wed, 12 Nov 2008 02:02:02 -0500</pubDate>
      <title>Re: Can nobody help me???</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239054#610407</link>
      <author>ImageAnalyst</author>
      <description>On Nov 11, 10:53=A0am, &quot;David&quot; &amp;lt;d...@bigcompany.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Vicky &amp;lt;bonsa...@gmx.de&amp;gt; wrote in message &amp;lt;gfc8tj$4m...@aioe.org&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hallo there,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; this is my code:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; image1 =3D imread('image1.bmp');&lt;br&gt;
&amp;gt; &amp;gt; image1 =3D im2bw(image1);&lt;br&gt;
&amp;gt; &amp;gt; M =3D bwlabel(image1, 8);&lt;br&gt;
&amp;gt; &amp;gt; imwrite(M, 'myImage.bmp');&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; How can I save an image (bmp), so that in each pixel is the element of&lt;br&gt;
&amp;gt; &amp;gt; the matrice M?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; If I save the matrice M with the command &quot;imwrite&quot; in each pixel of the&lt;br&gt;
&amp;gt; &amp;gt; myImage.bmp is an rgb-value. But I don't want a rgb-value, I want the&lt;br&gt;
&amp;gt; &amp;gt; label (element) of the matrice M.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; How can I realize it?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Please I need help!!!&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Best regards,&lt;br&gt;
&amp;gt; &amp;gt; Vicky&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; well, a bmp file is normally a simple rgb format. =A0read the help for im=&lt;br&gt;
write and see if one of the other formats may be better for what you want. =&lt;br&gt;
=A0or you may just want to save M to something else, like a mat file instea=&lt;br&gt;
d of as an image.- Hide quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; - Show quoted text -&lt;br&gt;
&lt;br&gt;
---------------------------------------------&lt;br&gt;
Correct.  Save in Tiff format instead.  It can take monochrome.&lt;br&gt;
Regards,&lt;br&gt;
ImageAnalyst</description>
    </item>
    <item>
      <pubDate>Thu, 13 Nov 2008 12:21:12 -0500</pubDate>
      <title>Re: Can nobody help me???</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239054#610673</link>
      <author>Vicky</author>
      <description>Hi ImageAnalyst,&lt;br&gt;
&lt;br&gt;
Thank you for your answer.&lt;br&gt;
I saved it in tiff format but I still get rgb-values.&lt;br&gt;
&lt;br&gt;
This is my code:&lt;br&gt;
&lt;br&gt;
image1 = imread('org_001.bmp');&lt;br&gt;
image1 = im2bw(image1);&lt;br&gt;
L1 = bwlabel(image1, 8);&lt;br&gt;
imwrite(L1/255, 'image.tiff')&lt;br&gt;
&lt;br&gt;
In each pixel is an rgb value like (8, 8, 8) or (12, 12, 12). But I want &lt;br&gt;
that in each pixel is the label like 1, 2,...8,...12,...&lt;br&gt;
That means that in each pixel should be a single scalar value and not &lt;br&gt;
the color.&lt;br&gt;
&lt;br&gt;
What I'm doing wrong when saving?&lt;br&gt;
&lt;br&gt;
Then I have a question. In my original rgb images are more than 256 &lt;br&gt;
colors. Is it still possible to create a monochrome image, so that each &lt;br&gt;
color get a seperate label?&lt;br&gt;
&lt;br&gt;
Can you please help me again?&lt;br&gt;
&lt;br&gt;
Best regards,&lt;br&gt;
Vicky&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
ImageAnalyst schrieb:&lt;br&gt;
&amp;gt; On Nov 11, 10:53 am, &quot;David&quot; &amp;lt;d...@bigcompany.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;&amp;gt; Vicky &amp;lt;bonsa...@gmx.de&amp;gt; wrote in message &amp;lt;gfc8tj$4m...@aioe.org&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Hallo there,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; this is my code:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; image1 = imread('image1.bmp');&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; image1 = im2bw(image1);&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; M = bwlabel(image1, 8);&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; imwrite(M, 'myImage.bmp');&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; How can I save an image (bmp), so that in each pixel is the element of&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; the matrice M?&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; If I save the matrice M with the command &quot;imwrite&quot; in each pixel of the&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; myImage.bmp is an rgb-value. But I don't want a rgb-value, I want the&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; label (element) of the matrice M.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; How can I realize it?&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Please I need help!!!&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Best regards,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Vicky&lt;br&gt;
&amp;gt;&amp;gt; well, a bmp file is normally a simple rgb format.  read the help for imwrite and &lt;br&gt;
&amp;gt;&amp;gt; see if one of the other formats may be better for what you want.  or you may just &lt;br&gt;
&amp;gt;&amp;gt; want to save M to something else, like a mat file instead of as an image.- Hide &lt;br&gt;
&amp;gt;&amp;gt;quoted text -&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; - Show quoted text -&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ---------------------------------------------&lt;br&gt;
&amp;gt; Correct.  Save in Tiff format instead.  It can take monochrome.&lt;br&gt;
&amp;gt; Regards,&lt;br&gt;
&amp;gt; ImageAnalyst</description>
    </item>
    <item>
      <pubDate>Fri, 14 Nov 2008 18:52:59 -0500</pubDate>
      <title>Re: Can nobody help me???</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239054#610956</link>
      <author>Walter Roberson</author>
      <description>Vicky wrote:&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&amp;gt; In each pixel is an rgb value like (8, 8, 8) or (12, 12, 12). But I want &lt;br&gt;
&amp;gt; that in each pixel is the label like 1, 2,...8,...12,...&lt;br&gt;
&amp;gt; That means that in each pixel should be a single scalar value and not &lt;br&gt;
&amp;gt; the color.&lt;br&gt;
&lt;br&gt;
I'm not clear on what you are asking. With your repetitions of the fact that you&lt;br&gt;
want each pixel to be the &quot;label&quot; and not the colour, then it sounds like what you&lt;br&gt;
want to produce is an image in which everywhere that the original image would&lt;br&gt;
have been labeled with 1, the new image would show the -character- 1, and so&lt;br&gt;
on -- an image composed of text drawn in to the appropriate places.&lt;br&gt;
&lt;br&gt;
If your goal was just to store binary data corresponding to the label, then&lt;br&gt;
it is not clear why you would bother to store it in an image file, but there is&lt;br&gt;
some hidden Very Good Reason For This, then create a new matrix which is&lt;br&gt;
NewImageG = uint16(LabelMatrix);&lt;br&gt;
and write that out using 'png' or 'ppm' or 'jpg' format. You may need&lt;br&gt;
to use the jpg options&lt;br&gt;
'Bitdepth', 16, 'Mode', 'lossless'&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
If you -must- use BMP for your purposes, then if L is your label matrix:&lt;br&gt;
&lt;br&gt;
L16 = uint16(L);&lt;br&gt;
Lrgb = cat(3,zeros(size(L16),'uint8'),uint8(bitshift(L16,-8)),uint8(bitand(L16,uint16(255))));&lt;br&gt;
imwrite(Lrgb, 'FileName.bmp');&lt;br&gt;
&lt;br&gt;
and to read the values back in:&lt;br&gt;
&lt;br&gt;
Lrgb = imread('FileName.bmp');&lt;br&gt;
L = bitor(bitshift(uint16(Lrgb(:,:,2)),8),uint16(Lrgb(:,:,3)));&lt;br&gt;
&lt;br&gt;
This code would need some minor adjustment if you have more than 65535 labels.&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
.signature note: I am now avoiding replying to unclear or ambiguous postings.&lt;br&gt;
Please review questions before posting them. Be specific. Use examples of what you mean,&lt;br&gt;
of what you don't mean. Specify boundary conditions, and data classes and value&lt;br&gt;
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?</description>
    </item>
    <item>
      <pubDate>Sat, 15 Nov 2008 03:45:03 -0500</pubDate>
      <title>Re: Can nobody help me???</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239054#611022</link>
      <author>Image Analyst</author>
      <description>Vicky &amp;lt;bonsai19@gmx.de&amp;gt; wrote in message &amp;lt;gfh642$6gh$1@aioe.org&amp;gt;...&lt;br&gt;
&amp;gt; Hi ImageAnalyst,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thank you for your answer.&lt;br&gt;
&amp;gt; I saved it in tiff format but I still get rgb-values.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This is my code:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; image1 = imread('org_001.bmp');&lt;br&gt;
&amp;gt; image1 = im2bw(image1);&lt;br&gt;
&amp;gt; L1 = bwlabel(image1, 8);&lt;br&gt;
&amp;gt; imwrite(L1/255, 'image.tiff')&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In each pixel is an rgb value like (8, 8, 8) or (12, 12, 12). But I want &lt;br&gt;
&amp;gt; that in each pixel is the label like 1, 2,...8,...12,...&lt;br&gt;
&amp;gt; That means that in each pixel should be a single scalar value and not &lt;br&gt;
&amp;gt; the color.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What I'm doing wrong when saving?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Then I have a question. In my original rgb images are more than 256 &lt;br&gt;
&amp;gt; colors. Is it still possible to create a monochrome image, so that each &lt;br&gt;
&amp;gt; color get a seperate label?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Can you please help me again?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Best regards,&lt;br&gt;
&amp;gt; Vicky&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ImageAnalyst schrieb:&lt;br&gt;
&amp;gt; &amp;gt; On Nov 11, 10:53 am, &quot;David&quot; &amp;lt;d...@bigcompany.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Vicky &amp;lt;bonsa...@gmx.de&amp;gt; wrote in message &amp;lt;gfc8tj$4m...@aioe.org&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; Hallo there,&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; this is my code:&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; image1 = imread('image1.bmp');&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; image1 = im2bw(image1);&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; M = bwlabel(image1, 8);&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; imwrite(M, 'myImage.bmp');&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; How can I save an image (bmp), so that in each pixel is the element of&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; the matrice M?&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; If I save the matrice M with the command &quot;imwrite&quot; in each pixel of the&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; myImage.bmp is an rgb-value. But I don't want a rgb-value, I want the&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; label (element) of the matrice M.&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; How can I realize it?&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; Please I need help!!!&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; Best regards,&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; Vicky&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; well, a bmp file is normally a simple rgb format.  read the help for imwrite and &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; see if one of the other formats may be better for what you want.  or you may just &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; want to save M to something else, like a mat file instead of as an image.- Hide &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;quoted text -&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; - Show quoted text -&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; ---------------------------------------------&lt;br&gt;
&amp;gt; &amp;gt; Correct.  Save in Tiff format instead.  It can take monochrome.&lt;br&gt;
&amp;gt; &amp;gt; Regards,&lt;br&gt;
&amp;gt; &amp;gt; ImageAnalyst&lt;br&gt;
-------------------------------------------------------&lt;br&gt;
OK, Vicky.  Run this code that I've posted before that will find blobs and label and measure them.  For you, I've adapted it to write out a tif image like you want, then i read it back in and display it with imtool so you can mouse around and inspect the values to verify that they are in fact the label values.&lt;br&gt;
Regards,&lt;br&gt;
ImageAnalyst&lt;br&gt;
&lt;br&gt;
disp(' ');&lt;br&gt;
disp('Running BlobsDemo.m...');&lt;br&gt;
originalImage = imread('coins.png'); % Read in image&lt;br&gt;
binaryImage = im2bw(originalImage, 0.4);       % Threshold to binary&lt;br&gt;
&lt;br&gt;
subplot(3,2,1); imagesc(originalImage); colormap(gray(256)); title('Original Image');&lt;br&gt;
subplot(3,2,2); imagesc(binaryImage); colormap(gray(256)); title('Binary Image');&lt;br&gt;
&lt;br&gt;
labeledImage = bwlabel(binaryImage, 8);     % Label each blob so can do calc on it&lt;br&gt;
coloredLabels = label2rgb (labeledImage, 'hsv', 'k', 'shuffle'); % pseudo random color labels&lt;br&gt;
&lt;br&gt;
% Save the labeled image as a tif image.&lt;br&gt;
imwrite(uint16(labeledImage), 'tif_labels.tif');&lt;br&gt;
tifimage = imread('tif_labels.tif');&lt;br&gt;
imtool(tifimage, []);  % Use imtool so she can inspect the values.&lt;br&gt;
&lt;br&gt;
subplot(3,2,3); imagesc(labeledImage); title('Labeled Image');&lt;br&gt;
subplot(3,2,4); imagesc(coloredLabels); title('Pseudo colored labels');&lt;br&gt;
&lt;br&gt;
blobMeasurements = regionprops(labeledImage, 'all');   % Get all the blob properties.&lt;br&gt;
numberOfBlobs = size(blobMeasurements, 1);&lt;br&gt;
&lt;br&gt;
% bwboundaries returns a cell array, where each cell&lt;br&gt;
% contains the row/column coordinates for an object in the image.&lt;br&gt;
% Plot the borders of all the coins on the original&lt;br&gt;
% grayscale image using the coordinates returned by bwboundaries.&lt;br&gt;
subplot(3,2,5); imagesc(originalImage); title('Outlines');&lt;br&gt;
hold on;&lt;br&gt;
boundaries = bwboundaries(binaryImage);	&lt;br&gt;
for k = 1 : numberOfBlobs&lt;br&gt;
	thisBoundary = boundaries{k};&lt;br&gt;
	plot(thisBoundary(:,2), thisBoundary(:,1), 'g', 'LineWidth', 2);&lt;br&gt;
end&lt;br&gt;
hold off;&lt;br&gt;
&lt;br&gt;
fprintf(1,'Blob #      Mean Intensity  Area     Perimeter  Centroid\n');&lt;br&gt;
for k = 1 : numberOfBlobs           % Loop through all blobs.&lt;br&gt;
	% Find the mean of each blob.  (R2008a has a better way where you can pass the original image&lt;br&gt;
	% directly into regionprops.  The way below works for all versions including earlier versions.)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;thisBlobsPixels = blobMeasurements(k).PixelIdxList;  % Get list of pixels in current blob.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;meanGL = mean(originalImage(thisBlobsPixels));             % Find mean intensity (in original image!)&lt;br&gt;
	blobArea = blobMeasurements(k).Area;		% Get area.&lt;br&gt;
	blobPerimeter = blobMeasurements(k).Perimeter;		% Get perimeter.&lt;br&gt;
	blobCentroid = blobMeasurements(k).Centroid;		% Get centroid.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fprintf(1,'#%d %18.1f %11.1f %8.1f %8.1f %8.1f\n', k, meanGL, blobArea, blobPerimeter, blobCentroid);&lt;br&gt;
end&lt;br&gt;
msgbox('Finished running BlobsDemo.m.  Check out the figure window and the command window for the results.');</description>
    </item>
    <item>
      <pubDate>Sun, 16 Nov 2008 23:19:32 -0500</pubDate>
      <title>Re: Can nobody help me???</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239054#611198</link>
      <author>Vicky</author>
      <description>Hi ImageAnalyst,&lt;br&gt;
&lt;br&gt;
thank you very much for your help and the code.&lt;br&gt;
&lt;br&gt;
Best regards,&lt;br&gt;
Vicky&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
ImageAnalyst schrieb:&lt;br&gt;
&amp;gt; On Nov 11, 10:53 am, &quot;David&quot; &amp;lt;d...@bigcompany.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;&amp;gt; Vicky &amp;lt;bonsa...@gmx.de&amp;gt; wrote in message &amp;lt;gfc8tj$4m...@aioe.org&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Hallo there,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; this is my code:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; image1 = imread('image1.bmp');&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; image1 = im2bw(image1);&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; M = bwlabel(image1, 8);&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; imwrite(M, 'myImage.bmp');&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; How can I save an image (bmp), so that in each pixel is the element of&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; the matrice M?&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; If I save the matrice M with the command &quot;imwrite&quot; in each pixel of the&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; myImage.bmp is an rgb-value. But I don't want a rgb-value, I want the&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; label (element) of the matrice M.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; How can I realize it?&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Please I need help!!!&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Best regards,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Vicky&lt;br&gt;
&amp;gt;&amp;gt; well, a bmp file is normally a simple rgb format.  read the help for imwrite and &lt;br&gt;
&amp;gt;&amp;gt; see if one of the other formats may be better for what you want.  or you may just &lt;br&gt;
&amp;gt;&amp;gt; want to save M to something else, like a mat file instead of as an image.- Hide &lt;br&gt;
&amp;gt;&amp;gt; quoted text -&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; - Show quoted text -&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ---------------------------------------------&lt;br&gt;
&amp;gt; Correct.  Save in Tiff format instead.  It can take monochrome.&lt;br&gt;
&amp;gt; Regards,&lt;br&gt;
&amp;gt; ImageAnalyst</description>
    </item>
  </channel>
</rss>

