Skip to contents

matchKeypoints matches keypoints detected in two separate images. This is useful to find common features for image registration, for instance.

Usage

matchKeypoints(
  source,
  target,
  descriptor_matcher = "BruteForce-Hamming",
  match_frac = 0.15
)

Arguments

source, target

Single-channel Image objects containing the BRIEF descriptors of the source and target images, as produced by ORBkeypoints.

descriptor_matcher

A character string indicating the type of the descriptor matcher to use. It can be one of the followings: "BruteForce", "BruteForce-L1", "BruteForce-Hamming" (the default), "BruteForce-Hamming(2)", or "FlannBased".

match_frac

The fraction of top matches to keep (default: 0.15).

Value

A three-column matrix with the identities of the keypoints matched between the source and target images, and the distance between them (a lower distance indicates a better match).

See also

Author

Simon Garnier, garnier@njit.edu

Examples

balloon1 <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
balloon2 <- image(system.file("sample_img/balloon2.png", package = "Rvision"))
kp1 <- ORBkeypoints(balloon1, n_features = 40000)
kp2 <- ORBkeypoints(balloon2, n_features = 40000)
matchKeypoints(kp1$descriptors, kp2$descriptors, match_frac = 1)
#>        source target distance
#>   [1,]      2     10       16
#>   [2,]      7     11       16
#>   [3,]      5      9       22
#>   [4,]     34     33       27
#>   [5,]     33     31       29
#>   [6,]     40     35       31
#>   [7,]     28     30       33
#>   [8,]     91    102       34
#>   [9,]     95    105       35
#>  [10,]      8     15       35
#>  [11,]     41     60       38
#>  [12,]     78     94       38
#>  [13,]     43     61       40
#>  [14,]     16     36       42
#>  [15,]     54     40       42
#>  [16,]     59     40       42
#>  [17,]      4     98       42
#>  [18,]     45     64       43
#>  [19,]     38     33       43
#>  [20,]     56     76       43
#>  [21,]     96      5       44
#>  [22,]     35     33       44
#>  [23,]     79     94       44
#>  [24,]     81    100       44
#>  [25,]      6     24       45
#>  [26,]     44     63       46
#>  [27,]     88    101       46
#>  [28,]     50     70       48
#>  [29,]     21     56       48
#>  [30,]    103     19       48
#>  [31,]     65     79       48
#>  [32,]     92     96       49
#>  [33,]     64     19       49
#>  [34,]     52     79       49
#>  [35,]     66     19       50
#>  [36,]     26     60       50
#>  [37,]     47     41       51
#>  [38,]     83     83       52
#>  [39,]     32     43       52
#>  [40,]     76     93       53
#>  [41,]     60     43       54
#>  [42,]     51     24       56
#>  [43,]     42     34       56
#>  [44,]     46     40       56
#>  [45,]     68      4       57
#>  [46,]     53     43       58
#>  [47,]     19     25       58
#>  [48,]     80     59       58
#>  [49,]     75     88       60
#>  [50,]     67     81       60
#>  [51,]     36    106       62
#>  [52,]     22     56       62
#>  [53,]     12     89       62
#>  [54,]     17     24       62
#>  [55,]     74     88       62
#>  [56,]     85     90       63
#>  [57,]     27    127       63
#>  [58,]     93    121       63
#>  [59,]     14     37       63
#>  [60,]    102     19       64
#>  [61,]    117    126       65
#>  [62,]     39     99       65
#>  [63,]    115     10       65
#>  [64,]     18     24       65
#>  [65,]     94     98       65
#>  [66,]     89     95       66
#>  [67,]     61     75       66
#>  [68,]     63     76       66
#>  [69,]      3     27       66
#>  [70,]     58     17       66
#>  [71,]     97     45       67
#>  [72,]     20     27       67
#>  [73,]     29     93       67
#>  [74,]     30     41       67
#>  [75,]     70     86       67
#>  [76,]    104     17       68
#>  [77,]     84     90       68
#>  [78,]     86     92       68
#>  [79,]     62     41       69
#>  [80,]    107     40       69
#>  [81,]     10     89       69
#>  [82,]     37     99       69
#>  [83,]     23     25       69
#>  [84,]     98     76       69
#>  [85,]     25     18       69
#>  [86,]     57     76       70
#>  [87,]    105     98       70
#>  [88,]     11     54       70
#>  [89,]     90     30       70
#>  [90,]     31     90       71
#>  [91,]     99     17       71
#>  [92,]    119     61       72
#>  [93,]      9     26       72
#>  [94,]    112     13       73
#>  [95,]    120     26       73
#>  [96,]     15     37       73
#>  [97,]     24     43       73
#>  [98,]     72     40       73
#>  [99,]      1     40       73
#> [100,]    118    127       74
#> [101,]    100     30       74
#> [102,]     48      4       74
#> [103,]     73     62       75
#> [104,]    106    127       75
#> [105,]     69     29       77
#> [106,]     55    100       77
#> [107,]    114     10       79
#> [108,]    116    125       79
#> [109,]     13    109       79
#> [110,]     49     77       80
#> [111,]     77     23       81
#> [112,]    111     35       83
#> [113,]    113      3       83
#> [114,]    108     17       84
#> [115,]     87     29       84
#> [116,]    109     93       85
#> [117,]     71     14       85
#> [118,]     82      1       87
#> [119,]    110    122       88
#> [120,]    101     33       89