I'd like to make a sort of fuzzy compare between two images (A and B, with dimensions x,y). In order to do this I'd like to compute the variance between the two images where
variance = sum over (x,y) { [red(A(x,y))-red(B(x,y))]^2+[green(A(x,y))-green(B(x,y))]^2+[blue(A(x,y))-green(B(x,y))]^2 }/(x*y)
I think there must be a reasonably quick way to do this but thus far the best I've come up with is to output both A and B as text files and then go to work on it with an external program.
Compute variance between two images
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Compute variance between two images
compare -metric rmse image1 image2 null:
gives you the square root of the mean squared error, which is similar to what you are asking (barring the square root). So perhaps you can take that result and use some -fx calculation to square it to get close to your variance.
see compare statistics at http://www.imagemagick.org/Usage/compare/#compare
gives you the square root of the mean squared error, which is similar to what you are asking (barring the square root). So perhaps you can take that result and use some -fx calculation to square it to get close to your variance.
see compare statistics at http://www.imagemagick.org/Usage/compare/#compare
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Compute variance between two images
the 'mse' (mean square error) is the same as 'rmse' just does not do the final square root.
See Compare Statistics (raw notes)
http://www.imagemagick.org/Usage/compare/#statistics
See Compare Statistics (raw notes)
http://www.imagemagick.org/Usage/compare/#statistics
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/