How to take sum of grey value of an image

4 次查看(过去 30 天)
I want to calculate sum of grey value of an image. I have enclosed a image . So kindly provide MATLAB code

回答(1 个)

Rik
Rik 2018-3-15
编辑:Rik 2018-3-15
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 个评论
Guillaume
Guillaume 2018-3-15
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).

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by