필터 지우기
필터 지우기

Gray image to rgb image

조회 수: 3 (최근 30일)
Elysi Cochin
Elysi Cochin 2013년 8월 27일
댓글: Image Analyst 2022년 2월 19일
I converted a color image to gray using rgb2gray and denoised the image. Now i wanted to convert the denoised gray image to a color image... Is it possible.... Please can someone help me.... Please do reply....

채택된 답변

Image Analyst
Image Analyst 2013년 8월 27일
You can use ind2rgb() but you have to supply a colormap. It won't look like the original colors though - you lost those when you went to gray. Why don't you just denoise each channel one at a time? Or convert to hsv and denoise just the v channel. Either of those methods will not lose the color information like your method does.
  댓글 수: 3
kailas jobu
kailas jobu 2022년 2월 19일
i have this code that filters image,but when i use it with a colored image it turns grayscale. could you help me?
I = imread('phonebox2_noisy.bmp');
Im = rgb2gray(I);
noisy = imnoise(Im, 'salt & pepper',0.1);
[m,n] = size(noisy);
output = zeros(m,n);
output = uint8(output);
for i = 1:m
for j = 1:n
xmin = max(1,i-1);
xmax = min(m,i+1);
ymin = max(1,j-1);
ymax = min(n,j+1);
temp = noisy(xmin:xmax, ymin:ymax);
output(i,j) = median(temp(:));
end
end
figure(1);
set(gcf, 'Position', get(0,'ScreenSize'));
subplot(131),imshow(I),title('Original Image');
subplot(133),imshow(output),title('filtered image');
Image Analyst
Image Analyst 2022년 2월 19일
@kailas jobu, after you read this
attach 'phonebox2_noisy.bmp' in your own, new question.
Also attach the "noisy()" function. And you might want to consider medfilt2() instead of median.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Donghui  Sun
Donghui Sun 2013년 8월 27일
ind2rgb() or ind2rgb8().

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by