The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Tony Kittler

Posts: 109
Registered: 2/5/11
Re: convert binary to gray
Posted: Dec 27, 2012 12:42 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

ImageAnalyst <> wrote in message <>...
> On Jan 26, 10:53 am, u-ingenieria bd <>
> 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);


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 ?

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.