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:
Image RGB values

Subject: Image RGB values

From: Caitlin Jordan

Date: 28 Aug, 2014 03:09:09

Message: 1 of 3

I was wondering how I would go about calculating the average amount of red, green and blue in a given image? I want to write a function for this. My function takes as an input a 3D array containing and RGB image and returns three scalar outputs detailing the average amount of red green and blue. Thanks for any hints!

Subject: Image RGB values

From: Stephen Cobeldick

Date: 29 Aug, 2014 13:33:11

Message: 2 of 3

http://www.mathworks.com/help/matlab/ref/mean.html
Pay careful attention to the second (optional) argument <dim>... it is extremely useful. Hint: use "mean" twice, controlling the dimension each time.

Subject: Image RGB values

From: Image Analyst

Date: 1 Sep, 2014 02:26:09

Message: 3 of 3

Caitlin Jordan:
So you calculate the mean red, green, and blue. Is there anything wrong with that? Does it meed your needs or not? If not, tell us what you want to do. What you want TO DO, not how you think you need to get there (like getting the mean r, g, and b). Why don't you go over to Answers http://www.mathworks.com/matlabcentral/answers/ and attach your image and tell me what you want to measure in it.
-Image Analyst

Tags for 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