Main Content

immse

Mean-squared error

Description

err = immse(X,Y) calculates the mean-squared error (MSE) between the arrays X and Y. A lower MSE value indicates greater similarity between X and Y.

example

Examples

collapse all

Read image and display it.

ref = imread('pout.tif');
imshow(ref)

Figure contains an axes object. The hidden axes object contains an object of type image.

Create another image by adding noise to a copy of the reference image.

A = imnoise(ref,'salt & pepper', 0.02);
imshow(A)

Figure contains an axes object. The hidden axes object contains an object of type image.

Calculate mean-squared error between the two images.

err = immse(A, ref);
fprintf('\n The mean-squared error is %0.4f\n', err);
 The mean-squared error is 353.7631

Input Arguments

collapse all

Input array, specified as a numeric array of any dimension.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

Input array, specified as a numeric array of the same size and data type as X.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

Output Arguments

collapse all

Mean-squared error, returned as a positive number. The data type of err is double unless the input arguments are of data type single, in which case err is of data type single

Data Types: single | double

Extended Capabilities

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Version History

Introduced in R2014b

See Also

| | | | |