Anonymous user
Percentage difference between images: Difference between revisions
m
→{{header|zkl}}: verbiage
No edit summary |
m (→{{header|zkl}}: verbiage) |
||
Line 1,218:
throw(Exception.ValueError("width/height of the images must match!"));
Utils.Helpers.zipW(img1.data.howza(0),img2.data.howza(0)) // bytes, not strings
.reduce(fcn(totalDiff,[(a,b)]){ totalDiff +
.toFloat()/img1.w/img1.h/3/255; // or: .toFloat()/img1.data.len()/255
}</lang>
Take the bytes in each image, zip them together [lazily], sum the differences between each byte and normalize.
|