Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Gray image to rgb image

Asked by Elysi Cochin

Elysi Cochin

on 27 Aug 2013
Accepted Answer by Image Analyst

Image Analyst

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....

0 Comments

Elysi Cochin

Elysi Cochin

2 Answers

Answer by Image Analyst

Image Analyst

on 27 Aug 2013
Accepted answer

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.

I posted a demo here: Salt and pepper noise removal in a color image

1 Comment

Image Analyst

Image Analyst

on 27 Aug 2013

MATLAB has a rgb2ycbcr function and ycbcr2rgb function - try that. ALso, why are your arrays 4D arrays? Inside the custom-written functinos they're 3D arrays but I don't even know why they're that. Why aren't they 2D arrays like normal?

Image Analyst

Image Analyst

Answer by Donghui Sun

Donghui Sun

on 27 Aug 2013

ind2rgb() or ind2rgb8().

0 Comments

Donghui  Sun

Donghui Sun

Contact us