4.10.4 Images comparaison

Estimator between 2 images.

Detailed description

This application computes MSE (Mean Squared Error), MAE (Mean Absolute Error) and PSNR (Peak Signal to Noise Ratio) between the channel of two images (reference and measurement). The user has to set the used channel and can specify a ROI.

Parameters

This section describes in details the parameters available for this application. Table 4.160, page 817 presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is CompareImages.





Parameter key

Parameter type

Parameter description




ref

Group

Reference image properties

ref.in

Input image

Reference image

ref.channel

Int

Reference image channel

meas

Group

Measured image properties

meas.in

Input image

Measured image

meas.channel

Int

Measured image channel

roi

Group

Region Of Interest (relative to reference image)

roi.startx

Int

Start X

roi.starty

Int

Start Y

roi.sizex

Int

Size X

roi.sizey

Int

Size Y

mse

Float

MSE

mae

Float

MAE

psnr

Float

PSNR

inxml

XML input parameters file

Load otb application from xml file

outxml

XML output parameters file

Save otb application to xml file











Table 4.160: Parameters table for Images comparaison.

Reference image properties

Measured image properties

Region Of Interest (relative to reference image)

MSE Mean Squared Error value

MAE Mean Absolute Error value

PSNR Peak Signal to Noise Ratio value

Load otb application from xml file Load otb application from xml file

Save otb application to xml file Save otb application to xml file

Example

To run this example in command-line, use the following:

otbcli_CompareImages -ref.in GomaApres.png -ref.channel 1 -meas.in GomaAvant.png -meas.channel 2 -roi.startx 20 -roi.starty 30 -roi.sizex 150 -roi.sizey 200

To run this example from Python, use the following code snippet:

#!/usr/bin/python 
 
# Import the otb applications package 
import otbApplication 
 
# The following line creates an instance of the CompareImages application 
CompareImages = otbApplication.Registry.CreateApplication("CompareImages") 
 
# The following lines set all the application parameters: 
CompareImages.SetParameterString("ref.in", "GomaApres.png") 
 
CompareImages.SetParameterInt("ref.channel", 1) 
 
CompareImages.SetParameterString("meas.in", "GomaAvant.png") 
 
CompareImages.SetParameterInt("meas.channel", 2) 
 
CompareImages.SetParameterInt("roi.startx", 20) 
 
CompareImages.SetParameterInt("roi.starty", 30) 
 
CompareImages.SetParameterInt("roi.sizex", 150) 
 
CompareImages.SetParameterInt("roi.sizey", 200) 
 
# The following line execute the application 
CompareImages.ExecuteAndWriteOutput()

Limitations

None

Authors

This application has been written by OTB-Team.

See also

These additional ressources can be useful for further information: