Thread Subject: Please help me!!!

Subject: Please help me!!!

From: Vicky

Date: 10 Nov, 2008 11:48:54

Message: 1 of 6

Hallo there,

How can I save a binary labeled image, so that in each pixel are the
labels and not the rgb-value. The bitdepth should be 8 bit.

It would be gratefull, if somebody can help me.

Best regards,
Vicky

Subject: Please help me!!!

From: Yumnam Kirani Singh

Date: 10 Nov, 2008 12:06:10

Message: 2 of 6

Have you tried imwrite?

Subject: Please help me!!!

From: Vicky

Date: 10 Nov, 2008 12:17:04

Message: 3 of 6

Yes I tried imwrite and save. But both save my image as an rgb-image.
And no labels are in the image.

This is my code:

image1 = imread('blau1_001.bmp');
image1 = rgb2gray(image1);
L1 = bwlabel(image1, 8);
imwrite(L1, 'myImage_001.bmp');


Yumnam Kirani Singh schrieb:
> Have you tried imwrite?

Subject: Please help me!!!

From: Oliver Woodford

Date: 10 Nov, 2008 14:26:03

Message: 4 of 6

This is what I understand from your description:
L1 is a MxN double matrix containing integers from 0 to k, where k is small (i.e. < 256). You want want to save L1.

What's wrong with the following?
save L1.mat L1
Or the following?
imwrite(uint8(L1), 'L1.bmp');

Please state what you get when you save L1 using both the above methods, then load them again. Surely you get back the original L1, no?

Subject: Please help me!!!

From: ImageAnalyst

Date: 12 Nov, 2008 01:05:52

Message: 5 of 6

On Nov 10, 6:48=A0am, Vicky <bonsa...@gmx.de> wrote:
> Hallo there,
>
> How can I save a binary labeled image, so that in each pixel are the
> labels and not the rgb-value. The bitdepth should be 8 bit.
>
> It would be gratefull, if somebody can help me.
>
> Best regards,
> Vicky

-------------------------------------
Maybe bmp saves as 24 bit RGB by default. Try saving as a tiff format
file.
Regards,
ImageAnalyst

Subject: Please help me!!!

From: Oliver Woodford

Date: 12 Nov, 2008 10:17:01

Message: 6 of 6

> Maybe bmp saves as 24 bit RGB by default. Try saving as a tiff format
> file.

In R2007b images with only 1 channel are saved as 8 bit greyscale images in BMP, and loaded with only 1 channel too, using imwrite and imread respectively.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com