-
Notifications
You must be signed in to change notification settings - Fork 31
op PSNR
The PSNR FireSight stage computes Peak Signal to Noise Ratio (PSNR). PSNR is a fast measure of image similarity. The PSNR for similar images is higher than the PSNR for dissimilar images. The PSNR for identical images is undefined in the literature, so FireSight by design returns "SAME".
-
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.
The model stores the PSNR value or "SAME" if the images are found to be similar as defined by threshold
{ "PSNR":"SAME" }
Example 1: Compare somewhat similar images pipeline
firesight -i img/pcb.jpg -p json/PSNR.json -Dpath=img/matchAngle.jpg
Pixel: 6ms
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 be glossed over by PSNR. The reason for this is that in this case, we have a highly local image difference (i.e., the green rectangles).
Example 2: Compare dissimilar images pipeline
firesight -i img/pcb.jpg -p json/PSNR.json -Dpath=img/matchCCORR_NORMED.jpg
Pixel: 6ms
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 3: Compare seemingly identical images pipeline
firesight -i img/matchAngle-64.png -p json/PSNR.json -Dpath=img/matchAngle.jpg
Pixel: 6ms
The following images were generated on different platforms running different versions of OpenCV. What's interesting about these pictures is that they look the same to the human eye. However, PSNR detects a slight difference.
matchAngle-64.png →
matchAngle.jpg →
PSNR value →
{ "PSNR":36.764313895181303 }
Images seen as identical can have PSNR values as low as 36.8dB.