View source: R/compare_similarities_same_image.R
compare_similarities_same_image | R Documentation |
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.
compare_similarities_same_image(rv)
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. |
A csv file containing the results
This is part of a suite of functions required to compare images.
Kurinchi Gurusamy
https://sites.google.com/view/equal-group/home
pairwise_comparison()
compare_similarities_two_images()
# 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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.