Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I am new to Opencv and i was studying about image processing and i have noticed one particular thing. I see that most of the image processing requires me to convert an bgr image to grayscale image. The book that i am following do not explain why we need to do that. So, i looked online and couldnt find any comprehensive answer.Can anyone explain me what's the reason that images are converted to gray-scale image for processing. Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 7-Nov-14 12:14pm    
Amazingly, there is no one single color transformation to do that. There are many different algorithms giving different quality of results depending on the image content.
The reason? Just because you may or may not need it.
—SA
[no name] 7-Nov-14 17:05pm    
There is no major reason to do this! What book are you reading?

Depending on what you have to solve sometimes grey scaled Images are first choice...other tasks need the "true" Colors.
Bruno

Google!

http://www.johndcook.com/blog/2009/08/24/algorithms-convert-color-grayscale/[^]

Possible reasons will depend on your application - such as computer vision, edge detection, creating a mask or alpha channel for overlays.
 
Share this answer
 
The main reason is that you either want to process the brightness information of an image, for example doing edge detection, or you want to do something with the color information, for example comparing if an object is colored in the same hue as on another image. To do that you need to separate the brightness information from the color information, which is mostly done by using an RGB (or BGR) to YHS (or YCbCr) transformation. In the latter color spaces it is a lot easier to compare colors than in RGB.
 
Share this answer
 
Comments
[no name] 7-Nov-14 17:33pm    
Quote: "for example comparing if an object is colored in the same hue as on another Image"

Sorry, but for this reducing an Image to grayscale is very counterproductive.


I did not read carefully enogh, sorry. Bruno

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900