Thread Subject: Converting grayscale image to RGB using mapping function

Subject: Converting grayscale image to RGB using mapping function

From: Francis Burton

Date: 10 Nov, 2009 14:44:54

Message: 1 of 3

I have a function that takes a value (0..1) and returns an [r, g, b]
triple. Is there a quick way to 'apply' it to a grayscale image MxN
to produce an RGB MxNx3 image?

Francis

Subject: Converting grayscale image to RGB using mapping function

From: ImageAnalyst

Date: 10 Nov, 2009 15:16:55

Message: 2 of 3

On Nov 10, 9:44 am, Francis Burton <fbur...@nyx.net> wrote:
> I have a function that takes a value (0..1) and returns an [r, g, b]
> triple. Is there a quick way to 'apply' it to a grayscale image MxN
> to produce an RGB MxNx3 image?
>
> Francis


------------------------------------------------------------------------------------------------------
You can use the function ind2rgb() in the image processing toolbox.
If you don't have that toolbox, you can very easily write it yourself.

Subject: Converting grayscale image to RGB using mapping function

From: fburton@nyx.net (Francis Burton)

Date: 10 Nov, 2009 16:25:11

Message: 3 of 3

In article <6bd8a425-59ea-4ddc-a65d-248cb44d39fb@15g2000yqy.googlegroups.com>,
ImageAnalyst <imageanalyst@mailinator.com> wrote:
>On Nov 10, 9:44?am, Francis Burton <fbur...@nyx.net> wrote:
>> I have a function that takes a value (0..1) and returns an [r, g, b]
>> triple. Is there a quick way to 'apply' it to a grayscale image MxN
>> to produce an RGB MxNx3 image?
>------------------------------------------------------------------------------------------------------
>You can use the function ind2rgb() in the image processing toolbox.
>If you don't have that toolbox, you can very easily write it yourself.

There it was - right under my eyes! The trick was realizing that
a double matrix in the range 0..1 can be converted into a true
indexed image by

im_indexed = floor(data*size(map,1));

Thanks for pointing me in the right direction.

Francis

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com