Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Commits
1196eb33
Commit
1196eb33
authored
Oct 26, 2018
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove non-ideal pairs when using crosscheck in batchdistance
parent
cc2f8f17
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
batch_distance.cpp
modules/core/src/batch_distance.cpp
+11
-2
No files found.
modules/core/src/batch_distance.cpp
View file @
1196eb33
...
...
@@ -297,19 +297,21 @@ void cv::batchDistance( InputArray _src1, InputArray _src2,
nidx
=
Scalar
::
all
(
-
1
);
}
if
(
crosscheck
)
{
CV_Assert
(
K
==
1
&&
update
==
0
&&
mask
.
empty
()
);
CV_Assert
(
!
nidx
.
empty
());
Mat
tdist
,
tidx
;
Mat
tdist
,
tidx
,
sdist
,
sidx
;
batchDistance
(
src2
,
src1
,
tdist
,
dtype
,
tidx
,
normType
,
K
,
mask
,
0
,
false
);
batchDistance
(
src1
,
src2
,
sdist
,
dtype
,
sidx
,
normType
,
K
,
mask
,
0
,
false
);
// if an idx-th element from src1 appeared to be the nearest to i-th element of src2,
// we update the minimum mutual distance between idx-th element of src1 and the whole src2 set.
// As a result, if nidx[idx] = i*, it means that idx-th element of src1 is the nearest
// to i*-th element of src2 and i*-th element of src2 is the closest to idx-th element of src1.
// If nidx[idx] = -1, it means that there is no such ideal couple for it in src2.
// This O(N) procedure is called cross-check and it helps to eliminate some false matches.
// This O(
2
N) procedure is called cross-check and it helps to eliminate some false matches.
if
(
dtype
==
CV_32S
)
{
for
(
int
i
=
0
;
i
<
tdist
.
rows
;
i
++
)
...
...
@@ -336,6 +338,13 @@ void cv::batchDistance( InputArray _src1, InputArray _src2,
}
}
}
for
(
int
i
=
0
;
i
<
sdist
.
rows
;
i
++
)
{
if
(
tidx
.
at
<
int
>
(
sidx
.
at
<
int
>
(
i
))
!=
i
)
{
nidx
.
at
<
int
>
(
i
)
=
-
1
;
}
}
return
;
}
...
...
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