Learn R Programming

VideoComparison (version 0.15)

VideoDistance: Calculate the distances between the two images provided in accordance to its hashes.

Description

Each image es represented by a list of hashes (in current implementation DCT, MW, RD, STRADA) and appropriate metrics is measured, per hash, to both images.

A list of distances is returned

Usage

VideoDistance(hh,h2)

Arguments

hh
List having hash descriptions for the image. Expected components are .dct .str .mw .rd
h2
List having hash descriptions for the image. Expected components are .dct .str .mw .rd

References

Espinosa-Gutiez, S., Ordieres-Mere, J., Bello-Garcia, A.: Large scale part-to-part video matching by a likelihood function using featured based video representation. TAMIDA 2013 - Taller de Mineria de Datos dentro del IV congreso Espannol de Informatica. 254-257 (2013). http://bioinspired.dacya.ucm.es/maeb2013/images/ActasCAEPIA_final.pdf

Cui, M., Femiani, J., Hu, J., Wonka, P., Razdan, A.: Curve matching for open 2D curves. Pattern Recogn. Lett. 30, 1-10 (2009)

Examples

Run this code

#Load json data from txt
fileName1 = strcat(path.package(package="VideoComparison"),"/extdata/imagehash1.gz")
json1 = readLines(gzfile(fileName1))
fileName2 = strcat(path.package(package="VideoComparison"),"/extdata/imagehash2.gz")
json2 = readLines(gzfile(fileName2))

# Extract data from json
out1<-fromJSON(json1)$hits$hits[[1]]$`_source`$Hash;
dct1<-as.character(out1[1])
hstrada1<-as.numeric(unlist(strsplit(out1[2],",")))
mw1<-as.numeric(unlist(strsplit(out1[3],",")))
rd1<-as.numeric(unlist(strsplit(out1[4],",")))
img1<-list(dct=dct1,hstrada=hstrada1,mw=mw1,rd=rd1)

out2<-fromJSON(json2)$hits$hits[[1]]$`_source`$Hash;
dct2<-as.character(out2[1])
hstrada2 <-as.numeric(unlist(strsplit(out2[2],",")))
mw2<-as.numeric(unlist(strsplit(out2[3],",")))
rd2<-as.numeric(unlist(strsplit(out2[4],",")))
img2<-list(dct=dct2,hstrada=hstrada2,mw=mw2,rd=rd2)


## Requires specific server architecture
# img1<-ExtractImgHash("000060","C0031D0")
# img2<-ExtractImgHash("000009","C0035D0")

mm<-VideoDistance(img1,img2);

Run the code above in your browser using DataLab