Learn R Programming

verifyr2 (version 1.0.0)

ImgFileComparator: ImgFileComparator.R

Description

ImgFileComparator.R

ImgFileComparator.R

Arguments

Super classes

verifyr2::FileComparator -> verifyr2::BinaryFileComparator -> ImgFileComparator

Public fields

image1_raw

extracted raw data for image1.

image2_raw

extracted raw data for image2.

Methods

Inherited methods


Method new()

Initialize a ImgFileComparator instance

Usage

ImgFileComparator$new(file1 = NULL, file2 = NULL, raw1 = NULL, raw2 = NULL)

Arguments

file1

First file to compare.

file2

Second file to compare.

raw1

First image in raw format to compare.

raw2

Second image in raw format to compare.


Method vrf_details_inner()

Method for comparing the inner part for the details query. This method can be overwritten by more specialized comparator classes. This method is intended to be called only by the comparator classes in the processing and shouldn't be called directly by the user.

Usage

ImgFileComparator$vrf_details_inner(config, omit)

Arguments

config

configuration values

omit

string pattern to omit from the comparison


Method vrf_details_inner_from_raw()

Internal method for comparing the earlier populated raw image contents in details and generating the difference highlight image in case differences are found.

Usage

ImgFileComparator$vrf_details_inner_from_raw(config)

Arguments

config

configuration values


Method vrf_details_inner_from_files()

Method for comparing the inner part for the details query with the file names as the base arguments. This is a part of a group of image processing functions that work with different image abstractions (file, image, raw image). These methods are intended to improve the performance so that best suiting method version can be used depending on what data is available from the earlier method calls to the same comparator instance.

Usage

ImgFileComparator$vrf_details_inner_from_files(config)

Arguments

config

configuration values


Method vrf_details_supported()

Inherited method for indicating whether detailed comparison is available with the current comparator. Returns an empty string if the comparator is is supported, otherwise a string that will be concatenated with the summary string.

Usage

ImgFileComparator$vrf_details_supported(config)

Arguments

config

configuration values


Method clone()

The objects of this class are cloneable with this method.

Usage

ImgFileComparator$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

Specialiced comparator for image file (jpg, jpef, png) comparison. This comparator contains the custom handling for handling only img content part for the comparison.

Examples

Run this code

# The normal way for creating a comparator would be to call the generic
# factory method verifyr2::create_comparator that will automatically create
# the correct comparator instance based on the file types.

file1 <- 'my_file1.jpg'
file2 <- 'my_file2.jpg'
comparator <- verifyr2::create_comparator(file1, file2)

# If needed, an explicit comparator can be created as well.

file1 <- 'my_file1.png'
file2 <- 'my_file2.png'
comparator <- ImgFileComparator$new(file1, file2)

# This comparator has also second explicit creation method that is used
# by the library for processing embedded image contents.

image1_raw <- 'raw hex vector data'
image2_raw <- 'raw hex vector data'
comparator <- ImgFileComparator$new(NULL, NULL, image1_raw, image2_raw)

Run the code above in your browser using DataLab