Viewing the difference of images
This demo shows a common example of comparing images by viewing differences through superposition.
Here, the imshowpair function is used to rotate the image.
Pkg.add(["TestImages"])
using Images
using TestImages
# Загрузка тестового изображения
img = float.(testimage("cameraman"))
# поверните изображение на 4 градуса
img_r = imrotate(img, -pi/45, axes(img))
The mosaicview function allows you to display multiple images. This method is especially useful when images have different sizes and colors.
mosaicview(img, img_r; nrow=1, npad=20, fillvalue=colorant"white")
In some cases, when the differences between two images are relatively minor, a simple visual comparison may not produce the desired result.
In this case, gray images can be filled with different RGB channels, an RGB representation can be created, and then converted to a grayscale image.
RGB_diffview = colorview(RGB, channelview(img), channelview(img_r), fill(0., size(img)))
Gray_diffview = Gray.(RGB_diffview)
Also, two images can be compared by calculating their difference.
plain_diffview = @. img - img_r
mosaicview(plain_diffview, RGB_diffview;
nrow=1, npad=20, fillvalue=colorant"white")
Conclusion
We have studied several ways of visual comparison, both through algebraic operations and through visual comparison. The figure above shows what these comparisons look like in a single output image.




