How to convert False color Images to Black & White?

Hi, I have an Image and I wanted that to convert into BW. But when I use im2bw(), it is not showing the black & white image. I here by attach the image.
Thank you...

 Réponse acceptée

I can't see the image. If you use rgb2gray() you probably won't get anything that makes sense. You really need to have the color map that was used to pseudocolor the image. If you have that you can recover the original gray scale image using
grayImage = rgb2ind(rgbImage, colorMap);
Then you can threshold that grayscale image to get a binary image. By the way, your image link is broken.

5 commentaires

Manoj Kumar
Manoj Kumar le 3 Juin 2014
Modifié(e) : Manoj Kumar le 3 Juin 2014
the image is a low contrast color image,, can you see it now ? I have attached it.
Image Analyst
Image Analyst le 3 Juin 2014
Modifié(e) : Image Analyst le 3 Juin 2014
No, can you? When I click on it, it says it has errors, and it doesn't show up in the body of your message either. Black and White is an ambiguous term so I never use it. It could be a monochrome image (if you're using the old terminology from the 1960's) or it could be a binary image, which is actually of "logical" type (true or false). I'm not 100% sure how you're using it. Usually people who want to convert a pseudocolor image want to convert it to monochrome, but you mentioned im2bw() which converts a grayscale image into a logical/binary image. So I don't know what the heck you want to do. Please clarify.
See my prior comment and define more precisely what black and white means to you. Why not just take the red channel?
grayImage = rgbImage(:,:,1);
I'm not sure what you mean, but see my attached freehand masking demo and see if that does what you want.
It worked, thank you..

Connectez-vous pour commenter.

Plus de réponses (1)

pallavi awate
pallavi awate le 14 Mar 2017

0 votes

hello sir, i have to count the object from the image.but their is some problem.when two object is too closed then it shows this is one object.now how i can solve this.please help me.can u send me the code for this.please please please..

1 commentaire

The code would have to be optimized for your image(s), which you have not provided.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Convert Image Type dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by