# imagemed22Y: Wasserstein Median of Images by You et al. (2022) In T4transport: Tools for Computational Optimal Transport

 imagemed22Y R Documentation

## Wasserstein Median of Images by You et al. (2022)

### Description

Given multiple images X_1,\ldots,X_N, the Wasserstein median of order 2 is computed. The proposed method relies on a choice of barycenter computation in that we opt for an algorithm of imagebary15B, which uses entropic regularization for barycenter computation. Please note the followings; (1) we only take a matrix as an image so please make it grayscale if not, (2) all images should be of same size - no resizing is performed.

### Usage

imagemed22Y(images, weights = NULL, lambda = NULL, ...)


### Arguments

 images a length-N list of same-size image matrices of size (m\times n). weights a weight of each image; if NULL (default), uniform weight is set. Otherwise, it should be a length-N vector of nonnegative weights. lambda a regularization parameter; if NULL (default), a paper's suggestion would be taken, or it should be a nonnegative real number. ... extra parameters including abstolstopping criterion for iterations (default: 1e-8). init.imagean initial weight image (default: uniform weight). maxitermaximum number of iterations (default: 496). nthreadnumber of threads for OpenMP run (default: 1). print.progressa logical to show current iteration (default: TRUE).

### Value

an (m\times n) matrix of the Wasserstein median image.

### Examples

## Not run:
#----------------------------------------------------------------------
#                       MNIST Data with Digit 3
#
# EXAMPLE : Very Small Example for CRAN; just showing how to use it!
#----------------------------------------------------------------------
data(digit3)
datsmall = digit3[1:10]

# COMPUTE
outsmall = imagemed22Y(datsmall, maxiter=5)

# VISUALIZE
par(mfrow=c(1,4), pty="s")
image(outsmall, xaxt='n', yaxt='n', main="Wasserstein Median")
image(datsmall[[3]], xaxt='n', yaxt='n', main="3rd image")
image(datsmall[[6]], xaxt='n', yaxt='n', main="6th image")
image(datsmall[[9]], xaxt='n', yaxt='n', main="9th image")
par(opar)

## End(Not run)



T4transport documentation built on April 12, 2023, 12:37 p.m.