color array to grayscale, images

2 次查看(过去 30 天)
I have two jpg images that I need to store as matrices of doubles then convert their color arrays into grayscale matrices. how would I do that?
*I attached the photos in a zip file

采纳的回答

Subhadeep Koley
Subhadeep Koley 2020-11-9
% Read the image
img1 = imread('photo1.jpg');
% Convert it to double
img1Double = im2double(img1);
% Convert from RGB to grayscale
img1Gray = rgb2gray(img1);
% Display the results
figure
imshowpair(img1, img1Gray, 'montage')
You can do the same for 'photo2.jpg'

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by