semimetric.BAGIDIS_2D: The BAGIDIS semi-distance for datasets of images

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/BAGIDIS_2D.r

Description

Function for computing the Bagidis semidistance between images.

Usage

1
2
semimetric.BAGIDIS_2D(Data1, Data2 = Data1, NbROW = NULL, wk=NULL,
 lambdaV = NULL, lambdaH = NULL, Type = c( "Array","Vector", "BD", "Flex"))

Arguments

Data1

A dataset of images. The way this dataset is encoded depend on Type. See Details. There must be at least two images.

Data2

A dataset of images encoded in the same way as Data1.

NbROW

If Type = "Vector", the number of row of the matrix representation associated to the image. Otherwise ignored.

wk

The weight function. For images of size N*M, this is a vector of length N*M-1 if Type in c("Vector", "Array", "BD") and a matrix of N*M-1 row and 6 columns if Type ="Flex". In the latter case, the columns refer to the weights associated to x1,y1,x2,y2, details and abs(details) respectively and the rows refer to the rank k = 1 to N-1 in the 2D-BUUHWE (SHAH). The 6th columns is usually 0. See References for details.

lambdaV

If Type in c("Vector", "Array", "BD"), the scaling parameter in the vertical direction. Otherwise ignored. It must be in [0,1] with lambdaV+ lambdaH <=1.

lambdaH

If Type in c("Vector", "Array", "BD"), the scaling parameter in the vertical direction. Otherwise ignored. It must be in [0,1] with lambdaV+ lambdaH <=1.

Type

One amongst ( "Array","Vector" "BD","Flex"). This indicates the way Data1 and Data2 encode the images to be compared. It also accounts for the specific form used for the BAGIDIS semidistance. See Details below.

Details

if Type="Vector" , the images are stored as vector of values encoded by row in the matrix Data1 (and Data2. There is one row per image and one column per pixel. The parameter NROW is required to specify the shape of the image (which is then a matrix constructed row by row).

If Type= "Array" , the images are stored as matrices along the third dimension of the array Data1 (or Data2). For instance, the first image is Data1[,,1].

If Type= "BD" or "Flex" , the images are encoded through their signatures (obtained from Signature_2D). Data1 (or Data2) is a list of signatures.

If Type in c("Vector", "Array", "BD"), the BAGIDIS semi-distance is used in its constrained form, with a vector weight function and three scaling parameters (lambdaV along the vertical direction, lambdaH along the horizontal diirection and a scaling parameter along the detail direction) which sum to 1. See References for more details, in particular Timmermans (2012), Chapter 4, and Timmermans and Fryzlewicz (2012). The values of lambdaV and lambdaH fix the scaling in the detail direction as 1 - lambdaV - lambdaH, which must remain nonnegative. Default values are provided if wk, lambdaV and lambdaH are nonspecified, as follows: wk = log(N+1-(1:N))/log(N+1) with N the number of pixels - 1, lambdaV=lambdaH=1/3 if both are nonspecified, lambdaH= (1-lambdaV)/2 or lambdaV= (1-lambdaH)/2 if only one is supplied.

If Type ="Flex", the BAGIDIS semi-distance is used in its general form with the matrix wk encoding a matrix weighting specifying the components of the signature at each rank. See References below, in particular Timmermans (2012), Chapter 4, and Timmermans and Fryzlewicz (2012). The absolute value of the detail is included in the signature, but can be ignored by defining the 6th column of wk as a vector of 0.

If only two images have to be compared to each other, both must be in Data1, and Data2 = Data1.

Value

The matrix of Bagidis semidistances between the nrow(DATA1) ima ges of DATA1 and the nrow(DATA2) images of DATA2. Dimensions: nrow(DATA1) x nrow(DATA2) .

Note

The equivalent function for curves is semimetric.BAGIDIS.

Author(s)

Catherine Timmermans, Institute of Statistics, Biostatistics and Actuarial Sciences, UCLouvain, Belgium.

Contact: catherine.timmermans@uclouvain.be

References

The main references are

Other references include

See Also

BUUHWE_2D, SHAH, semimetric.BAGIDIS.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
im = rbind(c(1,2,3), c(5,3,2), c(1,1,2))
im2 = rbind(c(1,1,5), c(5,5,2), c(1,0,0))

Data1= rbind(as.numeric(im),as.numeric(im2))
semimetric.BAGIDIS_2D(Data1, NbROW= 3, Type= 'Vector')

Data1= abind(im,im2, along=3)
semimetric.BAGIDIS_2D(Data1, Type= 'Array')

Data1= list(Signature_2D(SHAH(im)),Signature_2D(SHAH(im2)))
semimetric.BAGIDIS_2D(Data1, Type= 'BD')

Data1= list(Signature_2D(SHAH(im)),Signature_2D(SHAH(im2)))
wk = matrix(0, nrow=nrow(Data1[[1]]), ncol=ncol(Data1[[1]]))
wk[1:2,1:5] = rep(1,10)
semimetric.BAGIDIS_2D(Data1, Type= 'Flex', wk=wk)

  

Bagidis documentation built on May 29, 2017, noon