Skip to content
firepick1 edited this page Mar 8, 2014 · 12 revisions

FireSight stage computes Peak Signal to Noise Ratio (PSNR). The PSNR is a fast measure of image similarity. The PSNR for similar images is higher than the PSNR for dissimilar images. However the PSNR for identical images is undefined.

  • threshold If 0 or greater, this specifies the threshold below which images are treated as different. The default of -1 will only mark identical images as "SAME" in the model.
  • path Path to reference image to be compared to pipeline image

NOTE: The PSNR stage is used by FireSight itself in unit tests. OpenCV on different platforms transforms images in similar, but not identical ways. The PSNR stage is therefore helpful in comparing, for example, Raspberry Pi FireSight images with Windows FireSight images.

Model

The model stores the PSNR value or "SAME" if the images are found to be similar as defined by threshold

{
  "PSNR":"SAME"
}

Example: Compare somewhat similar images pipeline

target/firesight -i img/pcb.jpg -p json/PSNR.json -Dpath=img/matchAngle.jpg

pcb.jpg →

matchAngle.jpg →

PSNR value →

{ "PSNR":29.65368665440641 }

Note that the PSNR value is quite close to the 30-50dB range typical for PSNR values deemed acceptable for comparing lossy compressed images with their originals. This demonstrates that differences discernible to humans may not be detected by PSNR. The reason for this is that image difference is highly local (the green rectangles).

Example: Compare dissimilar images pipeline

target/firesight -i img/pcb.jpg -p json/PSNR.json -Dpath=img/matchCCORR_NORMED.jpg

pcb.jpg →

matchCCORR_NORMED.jpg →

PSNR value →

{ "PSNR":15.855542323067283 }

In this case, the PSNR indicates some similarity, but the PSNR is low enough to indicate that these images are different.

Example: Compare seemingly identical images pipeline

target/firesight -i img/matchAngle-win.png -p json/PSNR.json -Dpath=img/matchAngle.jpg

matchAngle-win.png →

matchAngle.jpg →

PSNR value →

{ "PSNR":36.764313895181303 }

Images seen as identical can have PSNR values as low as 36.8dB.

Clone this wiki locally