Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
34f910bb
Commit
34f910bb
authored
Mar 13, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1053 from Sahloul:features/surface_matching/ICP_accuracy
parents
1cb3a11f
978ff182
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
13 deletions
+8
-13
icp.cpp
modules/surface_matching/src/icp.cpp
+8
-13
No files found.
modules/surface_matching/src/icp.cpp
View file @
34f910bb
...
...
@@ -322,7 +322,6 @@ int ICP::registerModelToScene(const Mat& srcPC, const Mat& dstPC, double& residu
// initialize pose
matrixIdentity
(
4
,
pose
.
val
);
void
*
flann
=
indexPCFlann
(
dstPC0
);
Mat
M
=
Mat
::
eye
(
4
,
4
,
CV_64F
);
double
tempResidual
=
0
;
...
...
@@ -342,18 +341,14 @@ int ICP::registerModelToScene(const Mat& srcPC, const Mat& dstPC, double& residu
Mat
srcPCT
=
transformPCPose
(
srcPC0
,
pose
.
val
);
const
int
sampleStep
=
cvRound
((
double
)
n
/
(
double
)
numSamples
);
std
::
vector
<
int
>
srcSampleInd
;
srcPCT
=
samplePCUniform
(
srcPCT
,
sampleStep
);
/*
Note by Tolga Birdal
Downsample the model point clouds. If more optimization is required,
one could also downsample the scene points, but I think this might
decrease the accuracy. That's why I won't be implementing it at this
moment.
Also note that you have to compute a KD-tree for each level.
Tolga Birdal thinks that downsampling the scene points might decrease the accuracy.
Hamdi Sahloul, however, noticed that accuracy increased (pose residual decreased slightly).
*/
srcPCT
=
samplePCUniformInd
(
srcPCT
,
sampleStep
,
srcSampleInd
);
Mat
dstPCS
=
samplePCUniform
(
dstPC0
,
sampleStep
);
void
*
flann
=
indexPCFlann
(
dstPCS
);
double
fval_old
=
9999999999
;
double
fval_perc
=
0
;
...
...
@@ -416,7 +411,7 @@ int ICP::registerModelToScene(const Mat& srcPC, const Mat& dstPC, double& residu
// is assigned to the same model point m_j, then select p_i that corresponds
// to the minimum distance
hashtable_int
*
duplicateTable
=
getHashtable
(
newJ
,
numElSrc
,
dstPC
0
.
rows
);
hashtable_int
*
duplicateTable
=
getHashtable
(
newJ
,
numElSrc
,
dstPC
S
.
rows
);
for
(
di
=
0
;
di
<
duplicateTable
->
size
;
di
++
)
{
...
...
@@ -463,7 +458,7 @@ int ICP::registerModelToScene(const Mat& srcPC, const Mat& dstPC, double& residu
const
int
indModel
=
indicesModel
[
di
];
const
int
indScene
=
indicesScene
[
di
];
const
float
*
srcPt
=
srcPCT
.
ptr
<
float
>
(
indModel
);
const
float
*
dstPt
=
dstPC
0
.
ptr
<
float
>
(
indScene
);
const
float
*
dstPt
=
dstPC
S
.
ptr
<
float
>
(
indScene
);
double
*
srcMatchPt
=
Src_Match
.
ptr
<
double
>
(
di
);
double
*
dstMatchPt
=
Dst_Match
.
ptr
<
double
>
(
di
);
int
ci
=
0
;
...
...
@@ -516,6 +511,7 @@ int ICP::registerModelToScene(const Mat& srcPC, const Mat& dstPC, double& residu
delete
[]
indices
;
tempResidual
=
fval_min
;
destroyFlann
(
flann
);
}
// Pose(1:3, 4) = Pose(1:3, 4)./scale;
...
...
@@ -533,7 +529,6 @@ int ICP::registerModelToScene(const Mat& srcPC, const Mat& dstPC, double& residu
residual
=
tempResidual
;
destroyFlann
(
flann
);
return
0
;
}
...
...
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