Skip to contents

A deep learning powered image registration tool

Usage

# image
img <- EBImage::readImage(
  system.file("extdata", "nuclei.tif", package = "img.matching") 
)
 
# rotated image as reference
ref_img <- EBImage::rotate(img, angle = 45)
layout(matrix(1:2, nrow = 1))
plot(img)
plot(ref_img)

reg <- register_images(fixed = ref_img, 
                       moving = img,
                       detector = "superpoint",
                       device = "mps")
#> Using default SuperPoint model from 'biocfm/img.matching' at HuggingFace!
#> 
#> ===== SuperPoint =====
#> n_keypoints1 n_keypoints2    n_matches    n_inliers inlier_ratio  runtime_sec 
#>  739.0000000  752.0000000  114.0000000  101.0000000    0.8859649    0.5382573 
#> 
#>  ===== Transformation =====
#> Transformation:
#>           [,1]       [,2]        [,3]
#> [1,] 0.7077890 -0.7076295 282.2893048
#> [2,] 0.7084431  0.7071671  -0.1058145
img_reg <- affine(x = img,
                   m = t(reg$transformation),
                   output.dim = dim(ref_img)[1:2], 
                   filter = "bilinear")
plot(img_reg)