EMDistance: Earth mover's distance between two sets of color clusters

Description Usage Arguments Value Examples

View source: R/04_comparison_metrics.R

Description

Calculates the Earth mover's distance (briefly, the amount of work required to move the data from one distribution to resemble the other distribution, or the amount of "dirt" you have to shovel weighted by how far you have to shovel it). Accounts for both color disparity and size disparity. Recommended unless binAvg is off for histogram generation.

Usage

1
EMDistance(T1, T2)

Arguments

T1

Dataframe (especially a dataframe as returned by link{extractClusters} or getImageHist, but first three columns must be coordinates).

T2

Another dataframe like T1.

Value

Earth mover's distance between the two dataframes (metric of overall bin similarity for a pair of 3-dimensional histograms).

Examples

1
2
3
4
5
6
7
## Not run: 
cluster.list <- colordistance::getHistList(system.file("extdata",
"Heliconius/Heliconius_B", package="colordistance"), lower=rep(0.8, 3),
upper=rep(1, 3))
colordistance:::EMDistance(cluster.list[[1]], cluster.list[[2]])

## End(Not run)

Example output

Using 3^3 = 27 total bins

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |==================                                                    |  25%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |====================================================                  |  75%
  |                                                                            
  |======================================================================| 100%Warning message:
In colordistance::getHistList(system.file("extdata", "Heliconius/Heliconius_B",  :
  RGB and HSV are device-dependent, perceptually non-uniform color spaces. See 'Color spaces' vignette for more information.

[1] 0.08913133

colordistance documentation built on March 21, 2021, 1:06 a.m.