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?

How to combine this R, G, B values of an image so that i have an image?

Asked by KARTHICK

KARTHICK (view profile)

on 15 Feb 2013

I have R,G,B values of an image separately. I need it as a single image.Can anyone tell how to put these values in a single matrix, so that i have a single image.

0 Comments

KARTHICK

KARTHICK (view profile)

Products

No products are associated with this question.

2 Answers

Answer by José-Luis

José-Luis (view profile)

on 15 Feb 2013
Accepted answer
your_image = cat(3,R,G,B);

1 Comment

KARTHICK

KARTHICK (view profile)

on 15 Feb 2013

Thank You :-)

José-Luis

José-Luis (view profile)

Answer by the cyclist

the cyclist (view profile)

on 15 Feb 2013
Edited by the cyclist

the cyclist (view profile)

on 15 Feb 2013

Assuming your R,G,B values are MxN arrays, then you need to stack them into an MxNx3 array.

You can do this with the cat() command:

>> RGB = cat(3,R,G,B);

You can display the resulting array with the image() command

>> image(RGB)

1 Comment

KARTHICK

KARTHICK (view profile)

on 15 Feb 2013

Thank You :-)

the cyclist

the cyclist (view profile)

Contact us