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
9ba659af
Commit
9ba659af
authored
6 years ago
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12660 from alalek:flann_drop_useless_mutex
parents
be989b3b
52f52f67
master
4.3.0
4.2.0
4.1.2
4.1.2-openvino
4.1.1
4.1.1-openvino
4.1.0
4.1.0-openvino
4.0.1
4.0.1-openvino
4.0.0
4.0.0-rc
4.0.0-openvino
4.0.0-beta
3.4.10
3.4.9
3.4.8
3.4.7
3.4.6
3.4.5
3.4.4
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
kmeans_index.h
modules/flann/include/opencv2/flann/kmeans_index.h
+4
-9
No files found.
modules/flann/include/opencv2/flann/kmeans_index.h
View file @
9ba659af
...
...
@@ -276,7 +276,7 @@ public:
public
:
KMeansDistanceComputer
(
Distance
_distance
,
const
Matrix
<
ElementType
>&
_dataset
,
const
int
_branching
,
const
int
*
_indices
,
const
Matrix
<
double
>&
_dcenters
,
const
size_t
_veclen
,
int
*
_count
,
int
*
_belongs_to
,
std
::
vector
<
DistanceType
>&
_radiuses
,
bool
&
_converged
,
cv
::
Mutex
&
_mtx
)
int
*
_count
,
int
*
_belongs_to
,
std
::
vector
<
DistanceType
>&
_radiuses
,
bool
&
_converged
)
:
distance
(
_distance
)
,
dataset
(
_dataset
)
,
branching
(
_branching
)
...
...
@@ -287,7 +287,6 @@ public:
,
belongs_to
(
_belongs_to
)
,
radiuses
(
_radiuses
)
,
converged
(
_converged
)
,
mtx
(
_mtx
)
{
}
...
...
@@ -311,12 +310,10 @@ public:
radiuses
[
new_centroid
]
=
sq_dist
;
}
if
(
new_centroid
!=
belongs_to
[
i
])
{
count
[
belongs_to
[
i
]]
--
;
count
[
new_centroid
]
++
;
CV_XADD
(
&
count
[
belongs_to
[
i
]],
-
1
)
;
CV_XADD
(
&
count
[
new_centroid
],
1
)
;
belongs_to
[
i
]
=
new_centroid
;
mtx
.
lock
();
converged
=
false
;
mtx
.
unlock
();
}
}
}
...
...
@@ -332,7 +329,6 @@ public:
int
*
belongs_to
;
std
::
vector
<
DistanceType
>&
radiuses
;
bool
&
converged
;
cv
::
Mutex
&
mtx
;
KMeansDistanceComputer
&
operator
=
(
const
KMeansDistanceComputer
&
)
{
return
*
this
;
}
};
...
...
@@ -801,8 +797,7 @@ private:
}
// reassign points to clusters
cv
::
Mutex
mtx
;
KMeansDistanceComputer
invoker
(
distance_
,
dataset_
,
branching
,
indices
,
dcenters
,
veclen_
,
count
,
belongs_to
,
radiuses
,
converged
,
mtx
);
KMeansDistanceComputer
invoker
(
distance_
,
dataset_
,
branching
,
indices
,
dcenters
,
veclen_
,
count
,
belongs_to
,
radiuses
,
converged
);
parallel_for_
(
cv
::
Range
(
0
,
(
int
)
indices_length
),
invoker
);
for
(
int
i
=
0
;
i
<
branching
;
++
i
)
{
...
...
This diff is collapsed.
Click to expand it.
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