File Exchange

image thumbnail

Universal Color to Gray Conversion

version (3.32 MB) by Reza Farrahi Moghaddam
This function provides some methods to convert a color image to a gray-value image.

1 Download

Updated 01 Jun 2015

View Version History

View License

The implemented methods are:
1) 'normal', 'standard': rgb2gray of Matlab; ITU-R Recommendation BT.601.
2) 'avg', 'average': the output is the average of all three channels.
3) 'minavg', 'min_avg', 'min_average', 'minimum_average': The minimum-average method introduced in [1] for document image processing. it has less color dependency.
4) 'dual', 'dual_transform': The Dual Transform [2].
[1] R. Farrahi Moghaddam and M. Cheriet, A multi-scale framework for adaptive binarization of degraded document images, Pattern Recognition, 43, pp. 2186--2198, 2010, DOI: 10.1016/j.patcog.2009.12.024
[2] R. Farrahi Moghaddam,, "A maximal-information color to gray conversion method
for document images: Toward an optimal grayscale representation for document image
binarization," 2013, [arXiv preprint arXiv:1306.6058, June 2013].
ugray0 = universal_color_to_gray_converter(u, method_flag, method_name);
u is the input color image.
method_flag is 'method'
method_name is one of above mentioned methods.
ugray0 is the output gray-level image.
ugray0 = universal_color_to_gray_converter(u);
u is the input color image.
ugray0 is the output gray-level image; in this case, the method is 'min_avg';

Cite As

Reza Farrahi Moghaddam (2021). Universal Color to Gray Conversion (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

sindhuja annareddy

sir how to get pixlabeler tool , where i can get it

Thanks Dan for noticing the missing part. Dual and PCA methods are not stable yet. I will add them soon. For now, they have been disabled.


my_convert_using_pca_to_dual and my_convert_using_pca
functions are missing.

Could the author provide them from completeness sake?

Hossein Ziaei Nafchi

Thank you Dr. Farrahi Moghaddam.


really good

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: Modified Haussdorf Fractal Dimension

Community Treasure Hunt

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

Start Hunting!