MATLAB Answers

How to take sum of grey value of an image

4 views (last 30 days)
Deva Narayanan
Deva Narayanan on 15 Mar 2018
Edited: Rik on 15 Mar 2018
I want to calculate sum of grey value of an image. I have enclosed a image . So kindly provide MATLAB code

  0 Comments

Sign in to comment.

Answers (1)

Rik
Rik on 15 Mar 2018
Edited: Rik on 15 Mar 2018
IM=imread('image.png');
%IM=mean(IM,3);%convert RGB to grey
IM=rgb2gray(IM);
sumval=sum(IM(:));
You forgot to attach the image. You should really consider a crash course Matlab, any half-decent tutorial will learn you how to do this.

  1 Comment

Guillaume
Guillaume on 15 Mar 2018
Note that while taking the unweighted mean of the red, green and blue channels is certainly a possible way of converting to grey, it is not the most conventional. Most grey conversions put more weight on the green channel ( rgb2gray uses the weights 0.299, 0.587 and 0.114 respectively).

Sign in to comment.

Sign in to answer this question.