Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Please help! Trying to convert greyscale image back to rgb. error "rbg" not defined when using conversion code.

1 回表示 (過去 30 日間)
Jonathan Harris
Jonathan Harris 2019 年 4 月 22 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Sun=imread('noisePhoto.jpg');
Sun2=rgb2gray(Sun);
subplot(1,3,1)
title('Original')
imshow(Sun)
[m,n]= size(Sun2);
output=zeros(m,n);
for i=1:m
for j=1:n
rmin=max(1,i-1);
rmax=min(m,i+1);
cmin=max(1,j-1);
cmax=min(n,j+1);
%neigborhood
temp=Sun(rmin:rmax,cmin:cmax);
output(i,j)=mean(temp(:));
end
end
output=uint8(output);
subplot(1,3,2),imshow(output)
rgb=cat(3,output,output,output);
subplot(1,3,3);
imshow(rbg);

回答 (1 件)

Naman Bhaia
Naman Bhaia 2019 年 5 月 2 日
I think it is saying 'rbg' not found becuase it seems to be a typographical error. Try 'imshow(rgb)' and see if it solves the issue you are facing. I tried running your code and after fixing the last line, it did not throw any other error.

Community Treasure Hunt

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

Start Hunting!

Translated by