evaluate mean
Posted: 2014-08-08T14:24:35-07:00
"-evaluate Mean" gives the wrong result. For example, with the official binary distro v6.8.9-6 for Windows 8.1:
The result should be (30%,35%,60%).
I think the problem is in statistic.c, function ApplyEvaluateOperator:
This is the same code as the AddEvaluateOperator case. This function is also used by EvaluateImages, which for the case of MeanEvaluateOperator divides by the number of images. So the solution isn't a simple patch:
"-evaluate Mean" [EDIT: I mean "-evaluate Median"] has a similar problem.
Code: Select all
F:\web\im>%IM%convert xc:rgb(10%,20%,70%) -evaluate Mean 50% txt:
# ImageMagick pixel enumeration: 1,1,65535,srgb
0,0: (60.0015%,70.0008%,100%) #999AB333FFFF srgb(60.0015%,70.0008%,100%)
I think the problem is in statistic.c, function ApplyEvaluateOperator:
Code: Select all
case MeanEvaluateOperator:
{
result=(MagickRealType) (pixel+value);
break;
}
Code: Select all
case MeanEvaluateOperator:
{
result=(MagickRealType) (pixel+value)/2.0;
break;
}