Azzera filtri
Azzera filtri

Convert Grayscale Image to Color Image Using Matlab

2 visualizzazioni (ultimi 30 giorni)
Jaja
Jaja il 25 Set 2014
Modificato: Meshooo il 26 Set 2014
From grayscale Image, how can I convert it to its original color. But not all the color. How can I convert it to its green, red, orange color. Is it possible. Any example?
  1 Commento
Chad Greene
Chad Greene il 25 Set 2014
Each pixel in a grayscale image has a single value corresponding only to its brightness. That's all the information you have. RGB images have three values, corresponding to the brightness of red, green, and blue, and these three are combined to create the colors we all know and love. It's easy to convert RGB pixels to a single brightness value and call it grayscale, but after that pixel has been converted from three color values to a single value, it's an underdefined problem to try and convert it back. Unless you want to start making artistic decisions.

Accedi per commentare.

Risposte (2)

Image Analyst
Image Analyst il 25 Set 2014
It doesn't restore the original colors, but the attached demo colorizes a freehand-drawn region. If you want something different, attach your grayscale image, describe the thing you want to colorize, and tell us how we are supposed to figure out the colors for each pixel.

Meshooo
Meshooo il 26 Set 2014
Modificato: Meshooo il 26 Set 2014
There is no method that can do it for you fully automatically, but maybe possible if you can assume the other missing parameters.
So for example, if you have an old photo of a face taken many years ago when not color photos were available, then you can convert it to a colored image if you guess the missing color component. So lets say you will do it using the HSV color space. So you need:
H = hue, that you should guess for the color of the hair, lips, skin, etc.
S = Saturation, you can guess how much white or black you should add.
I = Intensity, you already have it from you gray image.
So in this way you can change your image from gray to colored image based in your color guess.
Hope that helps.

Categorie

Scopri di più su Convert Image Type in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by