Main Content

immse

Mean-squared error

Description

example

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

Examples

collapse all

Read image and display it.

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

Figure contains an axes object. The 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 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 asX.

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 oferrisdoubleunless the input arguments are of data typesingle, in which caseerris of data typesingle

Data Types:single|double

Extended Capabilities

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

版本历史

Introduced in R2014b

See Also

|||||