Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: convert binary to gray
Replies: 7   Last Post: Dec 27, 2012 5:08 PM

 Messages: [ Previous | Next ]
 Tony Kittler Posts: 109 Registered: 2/5/11
Re: convert binary to gray
Posted: Dec 27, 2012 12:42 PM

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <9a257a26-211e-4107-8516-dc45e4d65373@iu7g2000pbc.googlegroups.com>...
> On Jan 26, 10:53 am, u-ingenieria bd <u.ingenieria...@gmail.com>
> wrote:

> > how to convert a logical binary image into same size gray image?
> >
> > I have tried y=bin2gray(x,'qam',16) function but here for x this
> > function does not take the binary image directly. all I need to
> > convert the binary image into grayscale image.

>
> ------------------------------------------------
> I never heard of that function. Simply do this:
> grayImage = uint8(binaryImage);
>
> or, if you want the true (1) to be mapped to 255 instead of 1, do
> this:
> grayImage = 255 * uint8(binaryImage);

Hi,

I have two images. They are;
tempBinaryImg : 320x320 double
GrayscaleImg : 320x320 double

When I write that
temp2 = tempBinaryImg.*(GrayscaleImg>0);
PreprocessedGrayscaleImg = uint8(Img).*uint8(temp2);

then I am getting PreprocessedGrayscaleImg as uint8. But I want to get the PreprocessedGrayscaleImg as double. So, I write

PgrayImg = double(PreprocessedGrayscaleImg);

but the PgrayImg is binary, it is not gray. How can I get the PreprocessedGrayscaleImg as double and gray ?

Date Subject Author
1/26/12 u-ingenieria bd
1/26/12 ImageAnalyst
1/26/12 Steven Lord
1/26/12 u-ingenieria bd
1/26/12 ImageAnalyst
1/27/12 Yumnam Kirani Singh
12/27/12 Tony Kittler
12/27/12 ImageAnalyst