views:

60

answers:

3

is there any difference between grey scale image and binary image?

+2  A: 

Yes, the one is grayscale, e.g. gray scales from 0.255, the binary imange is binary, that means black(0) or white(1).

EDIT: Convert grayscale to binary. Directly converting color images (like RGB) to binary is not that easy, because you have to handle every color channel within the image seperatly.

Converting to binary is done using a ceratin threshold. E.g. you can say, all pixels with gray > 125 will become white, the others black. There are several thresholding algorithm out there, but maybe the most common is Otsu. You can find it here Thresholding by Otsu

InsertNickHere
There are also 12- or 16-bit grayscale images, but otherwise this is correct.
Ignacio Vazquez-Abrams
Yeah, thats why I used "e.g.", just to show, that grayscale imange have an continuus range of gray values and binary in contrast behave like a "image of boolean".
InsertNickHere
thanx:) i know how to convert image in grey scale but can somebody tell me that how can i convert image in binary?
Sweety Khan
@Sweety Khan I have added this to my answer.
InsertNickHere
I'm not sure this will always be a satisfactory transformation; if anything it'd be like those [Obama Campaign Posters](http://www.studionemo.com/wp-content/uploads/2008/04/po26951-2.jpg), instead of the binary image example at [wikipedia](http://en.wikipedia.org/wiki/Binary_image), which uses dithering to try to "simulate" greyscale.
Justin L.
@Justin It will not alyways give you the best results or the results you need. But it is an approved algorithm for converting grayscale to binary and matlab uses this in their im2bw aswell. (If you dont pass an level argument, they call graythresh internally which uses otsu for finding a good threshold)
InsertNickHere
+1  A: 

A binary image has only two values for each pixel, 0 and 1 corresponding to black and white (or vice versa). A gray scale image has a certain number (probably 8) bits of information per pixel, hence, 256 possible grey values.

Of course, a grey scale image has a binary representation, but the smallest size of information is not a bit, so we don't call it a binary image.

edit Assuming you want to convert in Matlab, use im2bw. If you're not using Matlab, the idea of binarization is explained on that page as well. It's not difficult to port, it boils down to comparing every pixel to a threshold value.

Pieter
thanx:) i know how to convert image in grey scale but can somebody tell me that how can i convert image in binary?
Sweety Khan
+2  A: 

Yes, but I'm not sure what this has to do with C++ or programming. A binary image could be an image where pixels are only either red or blue.

Binary Image: http://en.wikipedia.org/wiki/Binary_image

Grayscale Image: http://en.wikipedia.org/wiki/Grayscale

BobbyShaftoe