How to convert RGB image to grayscale image
4 次查看(过去 30 天)
显示 更早的评论
Please help me to convert RGB image to grayscale without using rgb2gray().
0 个评论
采纳的回答
Image Analyst
2014-2-2
Sounds like homework. You can get the color channels:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
and then do a weighted average of them.
grayImage = a1 * redChannel + a2 * greenChannel + a3 * blueChannel;
Look up standard weights, or pick your own.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Modify Image Colors 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!