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 and display an image.

ref = imread("pout.tif");
imageshow(ref)

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

A = imnoise(ref,"salt & pepper",0.02);
imageshow(A)

Calculate the mean-squared error between the two images.

err = immse(A,ref)
err = 
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

expand all

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

Version History

Introduced in R2014b

See Also

| | | | |