How to convert RGB image to grayscale image
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
aarti sawant
am 2 Feb. 2014
Kommentiert: DGM
am 30 Nov. 2021
Please help me to convert RGB image to grayscale without using rgb2gray().
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 2 Feb. 2014
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.
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!