Fast global registration

The RANSAC based Global registration solution may take a long time due to countless model proposals and evaluations. [Zhou2016] introduced a faster approach that quickly optimizes line process weights of few correspondences. As there is no model proposal and evaluation involved for each iteration, the approach proposed in [Zhou2016] can save a lot of computational time.

This script compares the running time of RANSAC based Global registration and implementation of [Zhou2016].

 5# examples/Python/Advanced/fast_global_registration.py
 6
 7import open3d as o3d
 8from global_registration import *
 9import numpy as np
10import copy
11
12import time
13
14
15def execute_fast_global_registration(source_down, target_down, source_fpfh,
16                                     target_fpfh, voxel_size):
17    distance_threshold = voxel_size * 0.5
18    print(":: Apply fast global registration with distance threshold %.3f" \
19            % distance_threshold)
20    result = o3d.registration.registration_fast_based_on_feature_matching(
21        source_down, target_down, source_fpfh, target_fpfh,
22        o3d.registration.FastGlobalRegistrationOption(
23            maximum_correspondence_distance=distance_threshold))
24    return result
25
26
27if __name__ == "__main__":
28
29    voxel_size = 0.05  # means 5cm for the dataset
30    source, target, source_down, target_down, source_fpfh, target_fpfh = \
31            prepare_dataset(voxel_size)
32
33    start = time.time()
34    result_ransac = execute_global_registration(source_down, target_down,
35                                                source_fpfh, target_fpfh,
36                                                voxel_size)
37    print("Global registration took %.3f sec.\n" % (time.time() - start))
38    print(result_ransac)
39    draw_registration_result(source_down, target_down,
40                             result_ransac.transformation)
41
42    start = time.time()
43    result_fast = execute_fast_global_registration(source_down, target_down,
44                                                   source_fpfh, target_fpfh,
45                                                   voxel_size)
46    print("Fast global registration took %.3f sec.\n" % (time.time() - start))
47    print(result_fast)
48    draw_registration_result(source_down, target_down,
49                             result_fast.transformation)

Input

29    voxel_size = 0.05  # means 5cm for the dataset
30    source, target, source_down, target_down, source_fpfh, target_fpfh = \
31            prepare_dataset(voxel_size)

For the pair comparison, the script reuses the prepare_dataset function defined in Global registration. It produces a pair of downsampled point clouds as well as FPFH features.

Baseline

33    start = time.time()
34    result_ransac = execute_global_registration(source_down, target_down,
35                                                source_fpfh, target_fpfh,
36                                                voxel_size)
37    print("Global registration took %.3f sec.\n" % (time.time() - start))
38    print(result_ransac)
39    draw_registration_result(source_down, target_down,
40                             result_ransac.transformation)

This script calls RANSAC based Global registration as a baseline. After registration it displays the following result.

../../_images/ransac.png
RANSAC based global registration took 2.538 sec.

Fast global registration

With the same input used for a baseline, the next script calls the implementation of [Zhou2016].

15def execute_fast_global_registration(source_down, target_down, source_fpfh,
16                                     target_fpfh, voxel_size):
17    distance_threshold = voxel_size * 0.5
18    print(":: Apply fast global registration with distance threshold %.3f" \
19            % distance_threshold)
20    result = o3d.registration.registration_fast_based_on_feature_matching(
21        source_down, target_down, source_fpfh, target_fpfh,
22        o3d.registration.FastGlobalRegistrationOption(
23            maximum_correspondence_distance=distance_threshold))
24    return result

This script displays the following result.

../../_images/fgr.png
Fast global registration took 0.193 sec.

With proper configuration, the accuracy of fast global registration is even comparable with ICP. Please refer to [Zhou2016] for more experimental results.