CompareImages¶
Estimator between 2 images.
Description¶
Compute MSE (Mean Squared Error), MAE (Mean Absolute Error) and PSNR (Peak Signal to Noise Ratio) between two image bands (reference and measurement). The user has to set the used channel and can specify a ROI.
Parameters¶
Reference image properties¶
Reference image -ref.in image
Mandatory
Image used as reference in the comparison.
Reference image channel -ref.channel int
Default value: 1
Used channel for the reference image.
Measured image properties¶
Measured image -meas.in image
Mandatory
Image used as measured in the comparison.
Measured image channel -meas.channel int
Default value: 1
Used channel for the measured image.
Region Of Interest (relative to reference image)¶
Start X -roi.startx int
Default value: 0
ROI start x position.
Start Y -roi.starty int
Default value: 0
ROI start y position.
Size X -roi.sizex int
Default value: 0
Size along x in pixels.
Size Y -roi.sizey int
Default value: 0
Size along y in pixels.
MSE -mse float
Mandatory
Mean Squared Error value.
MAE -mae float
Mandatory
Mean Absolute Error value.
PSNR -psnr float
Mandatory
Peak Signal to Noise Ratio value.
count -count float
Mandatory
Nb of pixels which are different.
Available RAM (MB) -ram int
Default value: 256
Available memory for processing (in MB).
Examples¶
From the command-line:
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
From Python:
import otbApplication
app = otbApplication.Registry.CreateApplication("CompareImages")
app.SetParameterString("ref.in", "GomaApres.png")
app.SetParameterInt("ref.channel", 1)
app.SetParameterString("meas.in", "GomaAvant.png")
app.SetParameterInt("meas.channel", 2)
app.SetParameterInt("roi.startx", 20)
app.SetParameterInt("roi.starty", 30)
app.SetParameterInt("roi.sizex", 150)
app.SetParameterInt("roi.sizey", 200)
app.ExecuteAndWriteOutput()