-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MILESTONE: add correct copyright stamps to src files
- Loading branch information
Showing
116 changed files
with
3,322 additions
and
1,016 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
""" | ||
This file is part of TSLAM and distributed under the terms of the GPLv3. | ||
Copyright (C) 2023 Andrea Settimi <andrea dot settimi at epfl dot ch>, Hong-Bin Yang <hong dash bin dot yang at epfl dot ch> (IBOIS, EPFL) | ||
Redistribution and use in source and binary forms, with or without modification, are | ||
permitted provided that the following conditions are met: | ||
1. Redistributions of source code must retain the above copyright notice, this list of | ||
conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, this list | ||
of conditions and the following disclaimer in the documentation and/or other materials | ||
provided with the distribution. | ||
THIS SOFTWARE IS PROVIDED BY Andrea Settimi and Hong-Bin Yang ''AS IS'' AND ANY EXPRESS OR IMPLIED | ||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR | ||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
The views and conclusions contained in the software and documentation are those of the | ||
authors and should not be interpreted as representing official policies, either expressed | ||
or implied Andrea Settimi and Hong-Bin Yang. | ||
""" | ||
|
||
import numpy as np | ||
import open3d as o3d | ||
import copy | ||
|
||
def draw_registration_result(source, target, transformation): | ||
source_temp = copy.deepcopy(source) | ||
target_temp = copy.deepcopy(target) | ||
source_temp.paint_uniform_color([1, 0.706, 0]) | ||
target_temp.paint_uniform_color([0, 0.651, 0.929]) | ||
source_temp.transform(transformation) | ||
o3d.visualization.draw_geometries([source_temp, target_temp], | ||
zoom=0.4459, | ||
front=[0.9288, -0.2951, -0.2242], | ||
lookat=[1.6784, 2.0612, 1.4451], | ||
up=[-0.3402, -0.9189, -0.1996]) | ||
|
||
|
||
# Read the point cloud | ||
source = o3d.io.read_point_cloud("test_2.ply") | ||
target = o3d.io.read_point_cloud("test_1.ply") | ||
|
||
threshold = 10 | ||
trans_init = np.eye(4) | ||
|
||
reg_p2p = o3d.pipelines.registration.registration_icp( | ||
source, target, threshold, trans_init, | ||
o3d.pipelines.registration.TransformationEstimationPointToPoint(), | ||
o3d.pipelines.registration.ICPConvergenceCriteria(max_iteration=2000) | ||
) | ||
print(reg_p2p) | ||
print("Transformation is:") | ||
print(reg_p2p.transformation) | ||
draw_registration_result(source, target, reg_p2p.transformation) | ||
|
||
exit(0) | ||
|
||
# Get the oriented bounding box | ||
obbox = o3d.geometry.AxisAlignedBoundingBox.create_from_points(pcd.points) | ||
# obbox = obbox.get_minimal_oriented_bounding_box() | ||
obbox.color = (1, 0, 0) | ||
print(obbox) | ||
|
||
# Visualize the point cloud | ||
o3d.visualization.draw_geometries([pcd, obbox]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.