Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SPR_Implementation
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王鑫(21软)
SPR_Implementation
Commits
4453d9a7
Commit
4453d9a7
authored
May 16, 2022
by
王鑫(21软)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
f8f7fe69
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
solveicp.m
solveicp.m
+38
-0
No files found.
solveicp.m
0 → 100644
View file @
4453d9a7
%Function takes in A and B clusters, registers A to B using ICP, returns resultant transformation matrix and error calculation
% - Params:
% - A:initial point cloud [n,3]
% - B:target point cloud [m,3]
% - Return:
% - TR:solve rotation matrix [1,3]
% - RO:solve translation matrix [3,3]
% - e:registers error
function
[
R
,
T
,
e
]
=
solveicp
(
A
,
B
,
Mdl
,
R_0
,
T_0
)
%1.initialize variable parameters
k
=
1
;
error
=
0.0001
;
Iterator
=
50
;
R
=
R_0
;
T
=
T_0
;
%2.initial:kdtree algorithm to find the nearest point pair of two point clouds
trans
=
transform
(
A
,
R
,
T
);
e
=
calculateCost
(
trans
,
B
,
Mdl
);
%3.ICP loop
while
e
>
error
&&
k
<=
Iterator
%find the nearest point
idx
=
knnsearch
(
Mdl
,
trans
);
NN
=
B
(
idx
,:);
%svd solve: optimal matching matrix of two point clouds in current state
[
T_k
,
R_k
]
=
solvesvd
(
trans
,
NN
);
%Cumulative transformation T=[1,3] R=[3,3]
T
=
(
R_k
*
T
')'
+
T_k
;
R
=
R_k
*
R
;
trans
=
transform
(
A
,
R
,
T
);
%Update error E
e
=
sum
(
sqrt
(
sum
((
NN
-
trans
)
.^
2
,
2
)))/
length
(
trans
);
k
=
k
+
1
;
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment