Last post Jun 17, 2009 08:01 PM by SGWellens
Jun 17, 2009 12:38 PM|livewirerules|LINK
Im trying to calculate the mean of an image below is the partial code
for (x = 0; x < b.Height; x++)
for (y = 0; y < b.Width - 1; y++)
Color color = b.GetPixel(x, y);
temp = temp + Convert.ToUInt32(color.R);
z = b.Height * b.Width;
mM = Convert.ToUInt32(Math.Abs(temp / z));
the problem is that when i input a image i get the error "Additional information: Parameter must be positive and < Height."
why is that and how do i fix it??
Jun 17, 2009 08:01 PM|SGWellens|LINK
You've got x and y reversed for width and height.
FYI: Your algorithm is very slow, the article here describes a much, much faster method: