【Matlab圖像處理100問(wèn)】Q002:灰度化
Matlab圖像處理100問(wèn)?
問(wèn)題來(lái)源:https://github.com/gzr2017/ImageProcessing100Wen
圖像來(lái)源:https://wallhaven.cc/?
環(huán)境:Matlab 2020a+實(shí)時(shí)編輯器? ?花小白2020
作者:花小白2020





A002:
Img=imread("BaseImg.jpg");
[Ny,Nx,~]=size(Img);
ImgGray=uint8(zeros(Ny,Nx));
for iy=1:Ny
? ? for ix=1:Nx
? ? ? ? ImgGray(iy,ix)=0.2126*Img(iy,ix,1)+0.7152*Img(iy,ix,2)+0.0722*Img(iy,ix,3);
? ? end
end
imshow(ImgGray)
?花小白2020
標(biāo)簽: