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

Thread Subject:
creating rgb image using pixels values

Subject: creating rgb image using pixels values

From: Shobana

Date: 29 Dec, 2012 16:33:13

Message: 1 of 4

hai..
  I am having red,green and blue plane pixel values and i want to form image with this values.Is there any function is available in the matlab?
I tried cat() function and imwrite also but its not working.if anybody knows please help me

Subject: creating rgb image using pixels values

From: Sadik

Date: 30 Dec, 2012 01:56:07

Message: 2 of 4

Hi Shobana,

How about the following:

% Assuming you have three matrices R, G and B
I = uint8(zeros([size(R) 3]));
I(:,:,1) = R;
I(:,:,2) = G;
I(:,:,3) = B;

imwrite(I,'Combined.png');

Best.

Subject: creating rgb image using pixels values

From: Shobana

Date: 30 Dec, 2012 03:48:21

Message: 3 of 4

"Sadik " <sadik.hava@gmail.com> wrote in message <kbo6vn$2jk$1@newscl01ah.mathworks.com>...
> Hi Shobana,
>
> How about the following:
>
> % Assuming you have three matrices R, G and B
> I = uint8(zeros([size(R) 3]));
> I(:,:,1) = R;
> I(:,:,2) = G;
> I(:,:,3) = B;
>
> imwrite(I,'Combined.png');
>
> Best.

Thank you so much i got correct image

Subject: creating rgb image using pixels values

From: Image Analyst

Date: 30 Dec, 2012 04:48:26

Message: 4 of 4

"Shobana " <manoharanshobana@ymail.com> wrote in message <kbn609$gvt$1@newscl01ah.mathworks.com>...
> hai..
> I am having red,green and blue plane pixel values and i want to form image with this values.Is there any function is available in the matlab?
> I tried cat() function and imwrite also but its not working.if anybody knows please help me
--------------------------------------------------------------------------------------
cat() should work:

rgbImage = cat(3, redChannel, greenChannel, blueChannel);

You might need to cast the channels to uint8 beforehand depending on what you're going to do with the image. If you want to display it with imshow() or write it to disk with imwrite() you'll need to cast to uint8

rgbImage = cat(3, uint8(redChannel), uint8(greenChannel), uint8(blueChannel));

Or
imshow(uint8(rgbImage));

Tags for this Thread

No tags are associated with this thread.

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.

Contact us