Compute distance between two kanjivec objects based on hierarchical optimal transport
Source:R/kanji2.R
kanjidist.Rd
The kanji distance is based on matching hierarchical component structures in a nesting-free way across all levels. The cost for matching individual components is a cost for registering the components (i.e. alligning there position, scale and aspect ratio) plus the (relative unbalanced) Wasserstein distance between the registered components.
Usage
kanjidist(
k1,
k2,
compo_seg_depth1 = 3,
compo_seg_depth2 = 3,
p = 1,
C = 0.2,
type = c("rtt", "unbalanced", "balanced"),
size = 48,
lwd = 2.5,
verbose = FALSE
)
Arguments
- k1, k2
two objects of type
kanjivec
.- compo_seg_depth1, compo_seg_depth2
two integers \(\geq 1\). Specifies for each kanji the deepest level included for component matching. If 1, only the kanji itself is used.
- p
the order of the Wasserstein distance used for matching components. All distances and the penalty (if any) are taken to the
p
-th power (which is compensated by taking thep
-th root after summation).- C
the penalty for extra mass if
type
is"rtt"
or"unbalanced"
, i.e. we addC^p
per unit of extra mass (before applying thep
-th root).- type
the type of Wasserstein distance used for matching components based on bitmaps drawn from the stroke information in
k1
andk2
."unbalanced"
means the pixel values in the two images are interpreted as mass. The total masses can be very different. Extra mass can be disposed of at costC^p
per unit."rtt"
is computationally the same, but the final distance is divided by the maximum of the total ink in each kanji to the (1/p)."balanced"
means the pixel values are normalized so that both images have the same total mass 1. Everything has to be transported, i.e.\ disposal of mass is not allowed.- size
side length of the bitmaps used for matching components.
- lwd
linewidth for drawing the components in these bitmaps.
- verbose
logical. Whether to print detailed information on the cost for all pairs of components and the final matching.
Details
For the precise definition and details see the reference below. Parameter C
corresponds to \(b/2^{1/p}\) in the paper.
Warning
The interface and details of this function will change in the future. Currently only a minimal
set of parameters can be passed. The other parameters are fixed exactly as in the
"prototype distance" (4.1) of the reference below for better or worse.
There is a certain
tendency that exact matches of components are rather strongly favored (if the KanjiVG elements
agree this can overrule the unbalanced Wasserstein distance) and the penalties for
translation/scaling/distortion of components are somewhat mild.
The computation time is rather high (depending on the settings and kanji up to several
seconds per kanji pair). This can be alleviated somewhat by keeping the compo_seg_depth
parameters at 3 or lower and setting size = 32
(which goes well with lwd=1.8
).
Future versions will use a much faster line base optimal transport algorithm and further
speed-ups.
References
Dominic Schuhmacher (2023).
Distance maps between Japanese kanji characters based on hierarchical optimal transport.
ArXiv Preprint, doi:10.48550/arXiv.2304.02493
Examples
if (requireNamespace("ROI.plugin.glpk")) {
kanjidist(fivebetas[[4]], fivebetas[[5]])
kanjidist(fivebetas[[4]], fivebetas[[5]], verbose=TRUE)
# faster and similar:
kanjidist(fivebetas[[4]], fivebetas[[5]], compo_seg_depth1=2, compo_seg_depth2=2,
size=32, lwd=1.8, verbose=TRUE)
# slower and similar:
kanjidist(fivebetas[[4]], fivebetas[[5]], size=64, lwd=3.2, verbose=TRUE)
}
#> Loading required namespace: ROI.plugin.glpk
#> [[1]]
#> [[1]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 0.44659193
#> dist weight1 weight2 transx transy scalex scaley
#> 0.07491261 1.00000000 1.00000000 0.02808986 0.01027523 0.99614823 1.01739130
#> distortx distorty
#> 0.97912005 1.00000000
#> attr(,"elements")
#> [1] "郵" "陣"
#>
#> [[1]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 1.000000000 2.000000000 1.000000000 1.000000000 2.000000000 1.000000000
#> totcost dist weight1 weight2 transx transy
#> 0.784655125 0.119777514 1.000000000 0.313539590 -0.242366644 0.003627086
#> scalex scaley distortx distorty
#> 0.278411206 0.904819766 0.307697971 1.000000000
#> attr(,"elements")
#> [1] "郵" "⻖"
#>
#> [[1]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 1.00000000 3.00000000 1.00000000 1.00000000 2.00000000 2.00000000 0.37410355
#> dist weight1 weight2 transx transy scalex scaley
#> 0.07238802 1.00000000 0.68646041 0.13166785 0.01027523 0.72127316 1.01739130
#> distortx distorty
#> 0.70894370 1.00000000
#> attr(,"elements")
#> [1] "郵" "車"
#>
#>
#> [[2]]
#> [[2]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 2.00000000 1.00000000 2.00000000 1.00000000 1.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.42253813 0.07673603 0.63596141 1.00000000 0.17344037 -0.04693199
#> scalex scaley distortx distorty
#> 1.62168054 1.18936564 1.36348359 1.00000000
#> attr(,"elements")
#> [1] "垂" "陣"
#>
#> [[2]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 2.00000000 2.00000000 2.00000000 1.00000000 2.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.73608926 0.11918274 0.63596141 0.31353959 -0.09701614 -0.05358014
#> scalex scaley distortx distorty
#> 0.45323981 1.05776562 0.42848794 1.00000000
#> attr(,"elements")
#> [1] "垂" "⻖"
#>
#> [[2]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 2.00000000 3.00000000 2.00000000 1.00000000 2.00000000 2.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.21167340 0.05209631 0.63596141 0.68646041 0.27701835 -0.04693199
#> scalex scaley distortx distorty
#> 1.17419738 1.18936564 0.98724677 1.00000000
#> attr(,"elements")
#> [1] "垂" "車"
#>
#>
#> [[3]]
#> [[3]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 3.00000000 1.00000000 2.00000000 2.00000000 1.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.74031477 0.11324079 0.36403859 1.00000000 -0.22865325 0.04949527
#> scalex scaley distortx distorty
#> 3.12609719 1.12934319 2.76806663 1.00000000
#> attr(,"elements")
#> [1] "⻏" "陣"
#>
#> [[3]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 3.00000000 2.00000000 2.00000000 2.00000000 2.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.09672928 0.02541194 0.36403859 0.31353959 -0.49910976 0.04284713
#> scalex scaley distortx distorty
#> 0.87370581 1.00438448 0.86989178 1.00000000
#> attr(,"elements")
#> [1] "⻏" "⻖"
#>
#> [[3]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 3.00000000 3.00000000 2.00000000 2.00000000 2.00000000 2.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.71395276 0.11472293 0.36403859 0.68646041 -0.12507527 0.04949527
#> scalex scaley distortx distorty
#> 2.26348843 1.12934319 2.00425208 1.00000000
#> attr(,"elements")
#> [1] "⻏" "車"
#>
#>
#> [[4]]
#> [[4]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 4.0000000 1.0000000 3.0000000 1.0000000 1.0000000 1.0000000 0.7793960
#> dist weight1 weight2 transx transy scalex scaley
#> 0.1320157 0.2008847 1.0000000 0.1784862 -0.0793578 1.9756156 1.3153950
#> distortx distorty
#> 1.5019182 1.0000000
#> attr(,"elements")
#> [1] "千" "陣"
#>
#> [[4]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 4.00000000 2.00000000 3.00000000 1.00000000 2.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.72281488 0.11865299 0.20088472 0.31353959 -0.09197027 -0.08600594
#> scalex scaley distortx distorty
#> 0.55216033 1.16985017 0.47199235 1.00000000
#> attr(,"elements")
#> [1] "千" "⻖"
#>
#> [[4]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 4.0000000 3.0000000 3.0000000 1.0000000 2.0000000 2.0000000 0.6703091
#> dist weight1 weight2 transx transy scalex scaley
#> 0.1107852 0.2008847 0.6864604 0.2820642 -0.0793578 1.4304684 1.3153950
#> distortx distorty
#> 1.0874820 1.0000000
#> attr(,"elements")
#> [1] "千" "車"
#>
#>
#> [[5]]
#> [[5]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 5.0000000 1.0000000 3.0000000 2.0000000 1.0000000 1.0000000 0.8083822
#> dist weight1 weight2 transx transy scalex scaley
#> 0.1308616 0.1967095 1.0000000 0.1734404 -0.0409633 1.6216805 3.3620690
#> distortx distorty
#> 0.9325356 1.9333333
#> attr(,"elements")
#> [1] "g" "陣"
#>
#> [[5]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 5.00000000 2.00000000 3.00000000 2.00000000 2.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.81186521 0.12740729 0.19670949 0.31353959 -0.09701614 -0.04761145
#> scalex scaley distortx distorty
#> 0.45323981 2.99006532 0.29305836 1.93333333
#> attr(,"elements")
#> [1] "g" "⻖"
#>
#> [[5]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 5.0000000 3.0000000 3.0000000 2.0000000 2.0000000 2.0000000 0.7974040
#> dist weight1 weight2 transx transy scalex scaley
#> 0.1232692 0.1967095 0.6864604 0.2770183 -0.0409633 1.1741974 3.3620690
#> distortx distorty
#> 0.6752137 1.9333333
#> attr(,"elements")
#> [1] "g" "車"
#>
#>
#> [[6]]
#> [[6]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 6.000000000 1.000000000 3.000000000 3.000000000 1.000000000 1.000000000
#> totcost dist weight1 weight2 transx transy
#> 0.791288325 0.136493552 0.225647973 1.000000000 0.175825688 0.005499199
#> scalex scaley distortx distorty
#> 2.012543040 1.407404223 1.429968027 1.000000000
#> attr(,"elements")
#> [1] "土" "陣"
#>
#> [[6]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 6.000000000 2.000000000 3.000000000 3.000000000 2.000000000 1.000000000
#> totcost dist weight1 weight2 transx transy
#> 0.826973335 0.153554807 0.225647973 0.313539590 -0.094630821 -0.001148944
#> scalex scaley distortx distorty
#> 0.562481086 1.251678832 0.449381320 1.000000000
#> attr(,"elements")
#> [1] "土" "⻖"
#>
#> [[6]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 6.000000000 3.000000000 3.000000000 3.000000000 2.000000000 2.000000000
#> totcost dist weight1 weight2 transx transy
#> 0.727305007 0.122611823 0.225647973 0.686460410 0.279403670 0.005499199
#> scalex scaley distortx distorty
#> 1.457206099 1.407404223 1.035385624 1.000000000
#> attr(,"elements")
#> [1] "土" "車"
#>
#>
#> Overview of matches:
#>
#> labfrom labto costs masses masses1 masses2
#> 1 ⻏ ⻖ 0.09672928 0.3135396 0.3640386 0.3135396
#> 2 垂 車 0.21167340 0.6359614 0.6359614 0.6864604
#> Unmatched at cost 0.25: 0.050499
#>
#> Directly computed total cost based on this overview: 0.17756932132619
#> [[1]]
#> [[1]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 0.43282427
#> dist weight1 weight2 transx transy scalex scaley
#> 0.07360803 1.00000000 1.00000000 0.02808986 0.01027523 0.99614823 1.01739130
#> distortx distorty
#> 0.97912005 1.00000000
#> attr(,"elements")
#> [1] "郵" "陣"
#>
#> [[1]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 1.000000000 2.000000000 1.000000000 1.000000000 2.000000000 1.000000000
#> totcost dist weight1 weight2 transx transy
#> 0.780704076 0.118930021 1.000000000 0.313539590 -0.242366644 0.003627086
#> scalex scaley distortx distorty
#> 0.278411206 0.904819766 0.307697971 1.000000000
#> attr(,"elements")
#> [1] "郵" "⻖"
#>
#> [[1]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 1.00000000 3.00000000 1.00000000 1.00000000 2.00000000 2.00000000 0.36832288
#> dist weight1 weight2 transx transy scalex scaley
#> 0.07170271 1.00000000 0.68646041 0.13166785 0.01027523 0.72127316 1.01739130
#> distortx distorty
#> 0.70894370 1.00000000
#> attr(,"elements")
#> [1] "郵" "車"
#>
#>
#> [[2]]
#> [[2]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 2.00000000 1.00000000 2.00000000 1.00000000 1.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.41301626 0.07560606 0.63596141 1.00000000 0.17344037 -0.04693199
#> scalex scaley distortx distorty
#> 1.62168054 1.18936564 1.36348359 1.00000000
#> attr(,"elements")
#> [1] "垂" "陣"
#>
#> [[2]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 2.00000000 2.00000000 2.00000000 1.00000000 2.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.73097590 0.11810400 0.63596141 0.31353959 -0.09701614 -0.05358014
#> scalex scaley distortx distorty
#> 0.45323981 1.05776562 0.42848794 1.00000000
#> attr(,"elements")
#> [1] "垂" "⻖"
#>
#> [[2]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 2.00000000 3.00000000 2.00000000 1.00000000 2.00000000 2.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.20487990 0.05112955 0.63596141 0.68646041 0.27701835 -0.04693199
#> scalex scaley distortx distorty
#> 1.17419738 1.18936564 0.98724677 1.00000000
#> attr(,"elements")
#> [1] "垂" "車"
#>
#>
#> [[3]]
#> [[3]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 3.00000000 1.00000000 2.00000000 2.00000000 1.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.73480196 0.11222037 0.36403859 1.00000000 -0.22865325 0.04949527
#> scalex scaley distortx distorty
#> 3.12609719 1.12934319 2.76806663 1.00000000
#> attr(,"elements")
#> [1] "⻏" "陣"
#>
#> [[3]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 3.00000000 2.00000000 2.00000000 2.00000000 2.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.09582504 0.02512123 0.36403859 0.31353959 -0.49910976 0.04284713
#> scalex scaley distortx distorty
#> 0.87370581 1.00438448 0.86989178 1.00000000
#> attr(,"elements")
#> [1] "⻏" "⻖"
#>
#> [[3]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 3.00000000 3.00000000 2.00000000 2.00000000 2.00000000 2.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.70976175 0.11392045 0.36403859 0.68646041 -0.12507527 0.04949527
#> scalex scaley distortx distorty
#> 2.26348843 1.12934319 2.00425208 1.00000000
#> attr(,"elements")
#> [1] "⻏" "車"
#>
#>
#> Overview of matches:
#>
#> labfrom labto costs masses masses1 masses2
#> 1 ⻏ ⻖ 0.09582504 0.3135396 0.3640386 0.3135396
#> 2 垂 車 0.20487990 0.6359614 0.6359614 0.6864604
#> Unmatched at cost 0.25: 0.050499
#>
#> Directly computed total cost based on this overview: 0.17296540263549
#> [[1]]
#> [[1]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 1.00000000 0.45376699
#> dist weight1 weight2 transx transy scalex scaley
#> 0.07559294 1.00000000 1.00000000 0.02808986 0.01027523 0.99614823 1.01739130
#> distortx distorty
#> 0.97912005 1.00000000
#> attr(,"elements")
#> [1] "郵" "陣"
#>
#> [[1]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 1.000000000 2.000000000 1.000000000 1.000000000 2.000000000 1.000000000
#> totcost dist weight1 weight2 transx transy
#> 0.787058568 0.120301477 1.000000000 0.313539590 -0.242366644 0.003627086
#> scalex scaley distortx distorty
#> 0.278411206 0.904819766 0.307697971 1.000000000
#> attr(,"elements")
#> [1] "郵" "⻖"
#>
#> [[1]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 1.00000000 3.00000000 1.00000000 1.00000000 2.00000000 2.00000000 0.37875934
#> dist weight1 weight2 transx transy scalex scaley
#> 0.07293964 1.00000000 0.68646041 0.13166785 0.01027523 0.72127316 1.01739130
#> distortx distorty
#> 0.70894370 1.00000000
#> attr(,"elements")
#> [1] "郵" "車"
#>
#>
#> [[2]]
#> [[2]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 2.00000000 1.00000000 2.00000000 1.00000000 1.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.42776207 0.07735700 0.63596141 1.00000000 0.17344037 -0.04693199
#> scalex scaley distortx distorty
#> 1.62168054 1.18936564 1.36348359 1.00000000
#> attr(,"elements")
#> [1] "垂" "陣"
#>
#> [[2]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 2.00000000 2.00000000 2.00000000 1.00000000 2.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.73870009 0.11974420 0.63596141 0.31353959 -0.09701614 -0.05358014
#> scalex scaley distortx distorty
#> 0.45323981 1.05776562 0.42848794 1.00000000
#> attr(,"elements")
#> [1] "垂" "⻖"
#>
#> [[2]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 2.00000000 3.00000000 2.00000000 1.00000000 2.00000000 2.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.21513288 0.05258259 0.63596141 0.68646041 0.27701835 -0.04693199
#> scalex scaley distortx distorty
#> 1.17419738 1.18936564 0.98724677 1.00000000
#> attr(,"elements")
#> [1] "垂" "車"
#>
#>
#> [[3]]
#> [[3]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 3.00000000 1.00000000 2.00000000 2.00000000 1.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.74109286 0.11338660 0.36403859 1.00000000 -0.22865325 0.04949527
#> scalex scaley distortx distorty
#> 3.12609719 1.12934319 2.76806663 1.00000000
#> attr(,"elements")
#> [1] "⻏" "陣"
#>
#> [[3]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 3.00000000 2.00000000 2.00000000 2.00000000 2.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.09572261 0.02508803 0.36403859 0.31353959 -0.49910976 0.04284713
#> scalex scaley distortx distorty
#> 0.87370581 1.00438448 0.86989178 1.00000000
#> attr(,"elements")
#> [1] "⻏" "⻖"
#>
#> [[3]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 3.00000000 3.00000000 2.00000000 2.00000000 2.00000000 2.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.71596209 0.11511267 0.36403859 0.68646041 -0.12507527 0.04949527
#> scalex scaley distortx distorty
#> 2.26348843 1.12934319 2.00425208 1.00000000
#> attr(,"elements")
#> [1] "⻏" "車"
#>
#>
#> [[4]]
#> [[4]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 4.0000000 1.0000000 3.0000000 1.0000000 1.0000000 1.0000000 0.7807105
#> dist weight1 weight2 transx transy scalex scaley
#> 0.1324087 0.2008847 1.0000000 0.1784862 -0.0793578 1.9756156 1.3153950
#> distortx distorty
#> 1.5019182 1.0000000
#> attr(,"elements")
#> [1] "千" "陣"
#>
#> [[4]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 4.00000000 2.00000000 3.00000000 1.00000000 2.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.72577322 0.11928183 0.20088472 0.31353959 -0.09197027 -0.08600594
#> scalex scaley distortx distorty
#> 0.55216033 1.16985017 0.47199235 1.00000000
#> attr(,"elements")
#> [1] "千" "⻖"
#>
#> [[4]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 4.0000000 3.0000000 3.0000000 1.0000000 2.0000000 2.0000000 0.6729803
#> dist weight1 weight2 transx transy scalex scaley
#> 0.1112626 0.2008847 0.6864604 0.2820642 -0.0793578 1.4304684 1.3153950
#> distortx distorty
#> 1.0874820 1.0000000
#> attr(,"elements")
#> [1] "千" "車"
#>
#>
#> [[5]]
#> [[5]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 5.0000000 1.0000000 3.0000000 2.0000000 1.0000000 1.0000000 0.8094450
#> dist weight1 weight2 transx transy scalex scaley
#> 0.1311689 0.1967095 1.0000000 0.1734404 -0.0409633 1.6216805 3.3620690
#> distortx distorty
#> 0.9325356 1.9333333
#> attr(,"elements")
#> [1] "g" "陣"
#>
#> [[5]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 5.00000000 2.00000000 3.00000000 2.00000000 2.00000000 1.00000000
#> totcost dist weight1 weight2 transx transy
#> 0.81393038 0.12795289 0.19670949 0.31353959 -0.09701614 -0.04761145
#> scalex scaley distortx distorty
#> 0.45323981 2.99006532 0.29305836 1.93333333
#> attr(,"elements")
#> [1] "g" "⻖"
#>
#> [[5]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2 totcost
#> 5.0000000 3.0000000 3.0000000 2.0000000 2.0000000 2.0000000 0.7989914
#> dist weight1 weight2 transx transy scalex scaley
#> 0.1236453 0.1967095 0.6864604 0.2770183 -0.0409633 1.1741974 3.3620690
#> distortx distorty
#> 0.6752137 1.9333333
#> attr(,"elements")
#> [1] "g" "車"
#>
#>
#> [[6]]
#> [[6]][[1]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 6.000000000 1.000000000 3.000000000 3.000000000 1.000000000 1.000000000
#> totcost dist weight1 weight2 transx transy
#> 0.792221398 0.136810726 0.225647973 1.000000000 0.175825688 0.005499199
#> scalex scaley distortx distorty
#> 2.012543040 1.407404223 1.429968027 1.000000000
#> attr(,"elements")
#> [1] "土" "陣"
#>
#> [[6]][[2]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 6.000000000 2.000000000 3.000000000 3.000000000 2.000000000 1.000000000
#> totcost dist weight1 weight2 transx transy
#> 0.828363169 0.154392617 0.225647973 0.313539590 -0.094630821 -0.001148944
#> scalex scaley distortx distorty
#> 0.562481086 1.251678832 0.449381320 1.000000000
#> attr(,"elements")
#> [1] "土" "⻖"
#>
#> [[6]][[3]]
#> flatind1 flatind2 level1 ind1 level2 ind2
#> 6.000000000 3.000000000 3.000000000 3.000000000 2.000000000 2.000000000
#> totcost dist weight1 weight2 transx transy
#> 0.727824582 0.122732560 0.225647973 0.686460410 0.279403670 0.005499199
#> scalex scaley distortx distorty
#> 1.457206099 1.407404223 1.035385624 1.000000000
#> attr(,"elements")
#> [1] "土" "車"
#>
#>
#> Overview of matches:
#>
#> labfrom labto costs masses masses1 masses2
#> 1 ⻏ ⻖ 0.09572261 0.3135396 0.3640386 0.3135396
#> 2 垂 車 0.21513288 0.6359614 0.6359614 0.6864604
#> Unmatched at cost 0.25: 0.050499
#>
#> Directly computed total cost based on this overview: 0.179453784845399
#> [1] 0.1794538