compare_similarities_same_image: Compare similarities within sections of the same image

View source: R/compare_similarities_same_image.R

compare_similarities_same_imageR Documentation

Compare similarities within sections of the same image

Description

Divides the images into a number of sections (determined by the user) and uses magick to compare the similarities between the different sections of the images.It computes the absolute error and the perceptual hash of each pairwise comparison. Measures such as fuzz, root mean squared error are also available as optional measures.

Usage

compare_similarities_same_image(rv)

Arguments

rv

a list provided by user input containing the path to the image, the number of sections into which the width and height must be split, and the number of resizes.

Value

A csv file containing the results

Note

This is part of a suite of functions required to compare images.

Author(s)

Kurinchi Gurusamy

References

https://sites.google.com/view/equal-group/home

See Also

pairwise_comparison() compare_similarities_two_images()

Examples

# Create a plot
filename <- tempfile(fileext = ".png")
png(filename, width = 300, height = 450, units = "px")
plot.new()
hist(rnorm(100))
recordPlot()
dev.off()

# Create a list to simulate the uploads of shiny app
rv <- {list(
  file_upload_image_1 = cbind.data.frame(datapath = ""), 
  file_upload_image_2 = cbind.data.frame(datapath = ""), 
  stretch_images = "No", 
  number_of_resizes_between = 1,
  extra_parameters_between = c("fuzz"),
  file_upload_image = cbind.data.frame(datapath = ""), 
  number_of_splits = 3, 
  number_of_resizes_within = 1,
  extra_parameters_within = c("fuzz")
)}
# Allocate the file paths
rv$file_upload_image$datapath <- filename
# Perform the function
library(magick)
library("ggplot2")
library("cowplot")
library("knitr")
library("zip")

# Not run for CRAN checks because of time it takes to run
if (interactive()) {
results <- compare_similarities_same_image(rv)
}

EQUALCompareImages documentation built on Sept. 9, 2025, 5:35 p.m.