Friday, 4 January 2013

Converting a Color Image To Gray Scale

A gray scale image is an image which has the same RGB values.It means R=G=B.We need to take a Color Image which has the different RGB values in a pixel.We take an average of RGB value & put it into RGB values of Output Image.Then we get  grayscaled image of input Image.

Color Image

Gray Scale Image
Here we discuss different methods to convert a 24-bit color image into gray scale image .In both of these methods there are some predefined constant which are multiplied to the RGB values of pixel to get a grayscale image for every pixel.These predefined values are some standard values diffrent for all three values
& multiplied into them to get a grayscale image.

1)
Y' =  0.299 R + 0.587 G + 0.114 B
2)
                                                Y' =  0.2126 R + 0.7152 G + 0.0722 B
3)                                            Y'=0.333(R+G+B)
4)                                            Y' =Max (R,G,B)

   In this type we calculate Maximum value among RGB value put it into the place of two other color's values.

5)                                             Y' =Min (R,G,B)

In this type we calculate Minimum value among RGB value put it into the place of two other color's values.

6)                                            Y'= (Max(R,G,B)+Min(R,G,B)) /2
 In this type we calculate both Max & min of RGB values .& Then average of them put into place of rgb values 

If Input image is same then output from various aalgorithm is here:-


.
The Last two images are respectively with Max & MIn algo.The Image with max algo is more brighter & The image with min algo is least brighter than other images.
Rest all four images are almost same in vision. 

No comments:

Post a Comment