View image differences¶
This demonstration shows a common example of comparing images by viewing the differences due to overlapping.
Here, the imshowpair function is used to rotate the image to change 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 colours.
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 give the desired result.
Grey images in such a case can be filled with different RGB channels, create an RGB representation and then converted to a greyscale 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 explored several ways to visually compare both through algebraic operations and visual comparison. The figure above shows what these comparisons look like in a single output image.