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
0966b2de
Commit
0966b2de
authored
Nov 06, 2015
by
Oded Green
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed openmp from code
parent
7579ef5d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
54 deletions
+13
-54
estimated_covariance.cpp
modules/ximgproc/src/estimated_covariance.cpp
+13
-54
No files found.
modules/ximgproc/src/estimated_covariance.cpp
View file @
0966b2de
...
...
@@ -50,11 +50,6 @@ A previous and less efficient version of the algorithm can be found:
*/
#include "precomp.hpp"
//#include <opencv2/opencv.hpp>
#ifdef HAVE_OPENMP
#include <omp.h>
#endif
using
namespace
cv
;
using
namespace
std
;
...
...
@@ -101,7 +96,6 @@ private:
int
nc
;
int
pr
;
int
pc
;
int
threads
;
std
::
vector
<
Combination
>
combinationsTable
;
};
...
...
@@ -110,13 +104,6 @@ private:
EstimateCovariance
::
EstimateCovariance
(
int
pr_
,
int
pc_
){
pr
=
pr_
;
pc
=
pc_
;
#ifdef HAVE_OPENMP
threads
=
omp_get_num_procs
();
omp_set_num_threads
(
threads
);
#else
threads
=
1
;
#endif
}
EstimateCovariance
::~
EstimateCovariance
(){
...
...
@@ -178,47 +165,19 @@ void EstimateCovariance::computeEstimateCovariance(Mat inputData,Mat outputData)
void
EstimateCovariance
::
iterateCombinations
(
Mat
inputData
,
Mat
outputData
)
{
int
combsPerCPU
=
combinationCount
()
/
threads
;
int
remainder
=
combinationCount
()
%
threads
;
if
(
remainder
>
0
)
combsPerCPU
++
;
#ifdef HAVE_OPENMP
#pragma omp parallel
#endif
{
int
idx
;
int
combs
;
#ifdef HAVE_OPENMP
int
thread_id
=
omp_get_thread_num
();
#else
int
thread_id
=
0
;
#endif
int
startComb
;
if
(
remainder
>
thread_id
){
combs
=
combsPerCPU
;
startComb
=
(
thread_id
)
*
combsPerCPU
;
}
else
{
combs
=
combsPerCPU
-
1
;
startComb
=
remainder
*
combsPerCPU
+
(
thread_id
-
remainder
)
*
(
combsPerCPU
-
1
);
}
Mat
outputVector
(
pr
*
pc
,
1
,
DataType
<
std
::
complex
<
float
>
>::
type
);
std
::
vector
<
int
>
finalMatPosR
(
pr
*
pc
,
0
);
std
::
vector
<
int
>
finalMatPosC
(
pr
*
pc
,
0
);
for
(
idx
=
0
;
idx
<
combs
;
idx
++
){
outputVector
.
setTo
(
Scalar
(
0
,
0
));
for
(
unsigned
x
=
0
;
x
<
finalMatPosR
.
size
();
x
++
)
finalMatPosR
[
x
]
=
0
;
for
(
unsigned
x
=
0
;
x
<
finalMatPosC
.
size
();
x
++
)
finalMatPosC
[
x
]
=
0
;
computeOneCombination
(
startComb
++
,
inputData
,
outputData
,
outputVector
,
finalMatPosR
,
finalMatPosC
);
}
Mat
outputVector
(
pr
*
pc
,
1
,
DataType
<
std
::
complex
<
float
>
>::
type
);
std
::
vector
<
int
>
finalMatPosR
(
pr
*
pc
,
0
);
std
::
vector
<
int
>
finalMatPosC
(
pr
*
pc
,
0
);
int
combs
=
combinationCount
();
for
(
int
idx
=
0
;
idx
<
combs
;
idx
++
){
outputVector
.
setTo
(
Scalar
(
0
,
0
));
for
(
unsigned
x
=
0
;
x
<
finalMatPosR
.
size
();
x
++
)
finalMatPosR
[
x
]
=
0
;
for
(
unsigned
x
=
0
;
x
<
finalMatPosC
.
size
();
x
++
)
finalMatPosC
[
x
]
=
0
;
computeOneCombination
(
idx
++
,
inputData
,
outputData
,
outputVector
,
finalMatPosR
,
finalMatPosC
);
}
}
...
...
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