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
b8de57f8
Commit
b8de57f8
authored
Apr 28, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup unnecessary setNumThreads() calls
parent
c49d781e
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
55 additions
and
64 deletions
+55
-64
bgfg.cpp
modules/bgsegm/samples/bgfg.cpp
+0
-3
perf_deepflow.cpp
modules/optflow/perf/perf_deepflow.cpp
+0
-1
perf_disflow.cpp
modules/optflow/perf/perf_disflow.cpp
+0
-1
perf_variational_refinement.cpp
modules/optflow/perf/perf_variational_refinement.cpp
+0
-1
test_OF_reproducibility.cpp
modules/optflow/test/test_OF_reproducibility.cpp
+8
-2
trackerCSRT.cpp
modules/tracking/src/trackerCSRT.cpp
+0
-2
perf_adaptive_manifold.cpp
modules/ximgproc/perf/perf_adaptive_manifold.cpp
+1
-3
perf_bilateral_texture_filter.cpp
modules/ximgproc/perf/perf_bilateral_texture_filter.cpp
+1
-2
perf_disparity_wls_filter.cpp
modules/ximgproc/perf/perf_disparity_wls_filter.cpp
+0
-1
perf_domain_transform.cpp
modules/ximgproc/perf/perf_domain_transform.cpp
+1
-2
perf_fgs_filter.cpp
modules/ximgproc/perf/perf_fgs_filter.cpp
+1
-2
perf_guided_filter.cpp
modules/ximgproc/perf/perf_guided_filter.cpp
+1
-2
perf_l0_smooth.cpp
modules/ximgproc/perf/perf_l0_smooth.cpp
+1
-2
perf_rolling_guidance_filter.cpp
modules/ximgproc/perf/perf_rolling_guidance_filter.cpp
+1
-2
perf_weighted_median_filter.cpp
modules/ximgproc/perf/perf_weighted_median_filter.cpp
+1
-2
pref_joint_bilateral_filter.cpp
modules/ximgproc/perf/pref_joint_bilateral_filter.cpp
+1
-2
graphsegmentation_demo.cpp
modules/ximgproc/samples/graphsegmentation_demo.cpp
+0
-3
live_demo.cpp
modules/ximgproc/samples/live_demo.cpp
+2
-2
selectivesearchsegmentation_demo.cpp
...les/ximgproc/samples/selectivesearchsegmentation_demo.cpp
+0
-5
test_adaptive_manifold.cpp
modules/ximgproc/test/test_adaptive_manifold.cpp
+4
-5
test_bilateral_texture_filter.cpp
modules/ximgproc/test/test_bilateral_texture_filter.cpp
+4
-1
test_disparity_wls_filter.cpp
modules/ximgproc/test/test_disparity_wls_filter.cpp
+4
-2
test_domain_transform.cpp
modules/ximgproc/test/test_domain_transform.cpp
+4
-2
test_fgs_filter.cpp
modules/ximgproc/test/test_fgs_filter.cpp
+4
-2
test_guided_filter.cpp
modules/ximgproc/test/test_guided_filter.cpp
+4
-1
test_joint_bilateral_filter.cpp
modules/ximgproc/test/test_joint_bilateral_filter.cpp
+0
-4
test_l0_smooth.cpp
modules/ximgproc/test/test_l0_smooth.cpp
+4
-1
test_rolling_guidance_filter.cpp
modules/ximgproc/test/test_rolling_guidance_filter.cpp
+4
-3
test_sparse_match_interpolator.cpp
modules/ximgproc/test/test_sparse_match_interpolator.cpp
+4
-2
test_weighted_median_filter.cpp
modules/ximgproc/test/test_weighted_median_filter.cpp
+0
-1
No files found.
modules/bgsegm/samples/bgfg.cpp
View file @
b8de57f8
...
...
@@ -37,9 +37,6 @@ static Ptr<BackgroundSubtractor> createBGSubtractorByName(const String& algoName
int
main
(
int
argc
,
char
**
argv
)
{
setUseOptimized
(
true
);
setNumThreads
(
8
);
CommandLineParser
parser
(
argc
,
argv
,
keys
);
parser
.
about
(
about
);
parser
.
printMessage
();
...
...
modules/optflow/perf/perf_deepflow.cpp
View file @
b8de57f8
...
...
@@ -20,7 +20,6 @@ PERF_TEST_P(DenseOpticalFlow_DeepFlow, perf, Values(szVGA, sz720p))
randu
(
frame1
,
0
,
255
);
randu
(
frame2
,
0
,
255
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
TEST_CYCLE_N
(
1
)
{
Ptr
<
DenseOpticalFlow
>
algo
=
createOptFlow_DeepFlow
();
...
...
modules/optflow/perf/perf_disflow.cpp
View file @
b8de57f8
...
...
@@ -32,7 +32,6 @@ PERF_TEST_P(DenseOpticalFlow_DIS, perf,
MakeArtificialExample
(
frame1
,
frame2
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
TEST_CYCLE_N
(
10
)
{
Ptr
<
DenseOpticalFlow
>
algo
=
createOptFlow_DIS
(
preset
);
...
...
modules/optflow/perf/perf_variational_refinement.cpp
View file @
b8de57f8
...
...
@@ -23,7 +23,6 @@ PERF_TEST_P(DenseOpticalFlow_VariationalRefinement, perf, Combine(Values(szQVGA,
randu
(
frame2
,
0
,
255
);
flow
.
setTo
(
0.0
f
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
TEST_CYCLE_N
(
10
)
{
Ptr
<
VariationalRefinement
>
var
=
createVariationalFlowRefinement
();
...
...
modules/optflow/test/test_OF_reproducibility.cpp
View file @
b8de57f8
...
...
@@ -57,6 +57,9 @@ TEST_P(DenseOpticalFlow_DIS, MultithreadReproducibility)
OFParams
params
=
GetParam
();
Size
size
=
get
<
0
>
(
params
);
int
nThreads
=
cv
::
getNumThreads
();
if
(
nThreads
==
1
)
throw
SkipTestException
(
"Single thread environment"
);
for
(
int
iter
=
0
;
iter
<=
loopsCount
;
iter
++
)
{
Mat
frame1
(
size
,
CV_8U
);
...
...
@@ -79,7 +82,7 @@ TEST_P(DenseOpticalFlow_DIS, MultithreadReproducibility)
algo
->
setUseMeanNormalization
(
use_mean_normalization
);
algo
->
setUseSpatialPropagation
(
use_spatial_propagation
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
()
);
cv
::
setNumThreads
(
nThreads
);
Mat
resMultiThread
;
algo
->
calc
(
frame1
,
frame2
,
resMultiThread
);
...
...
@@ -111,6 +114,9 @@ TEST_P(DenseOpticalFlow_VariationalRefinement, MultithreadReproducibility)
OFParams
params
=
GetParam
();
Size
size
=
get
<
0
>
(
params
);
int
nThreads
=
cv
::
getNumThreads
();
if
(
nThreads
==
1
)
throw
SkipTestException
(
"Single thread environment"
);
for
(
int
iter
=
0
;
iter
<=
loopsCount
;
iter
++
)
{
Mat
frame1
(
size
,
CV_8U
);
...
...
@@ -128,7 +134,7 @@ TEST_P(DenseOpticalFlow_VariationalRefinement, MultithreadReproducibility)
var
->
setFixedPointIterations
(
rng
.
uniform
(
1
,
20
));
var
->
setOmega
(
rng
.
uniform
(
1.01
f
,
1.99
f
));
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
()
);
cv
::
setNumThreads
(
nThreads
);
Mat
resMultiThread
;
flow
.
copyTo
(
resMultiThread
);
var
->
calc
(
frame1
,
frame2
,
resMultiThread
);
...
...
modules/tracking/src/trackerCSRT.cpp
View file @
b8de57f8
...
...
@@ -506,8 +506,6 @@ bool TrackerCSRTImpl::updateImpl(const Mat& image_, Rect2d& boundingBox)
// *********************************************************************
bool
TrackerCSRTImpl
::
initImpl
(
const
Mat
&
image_
,
const
Rect2d
&
boundingBox
)
{
cv
::
setNumThreads
(
getNumThreads
());
//treat gray image as color image
Mat
image
;
if
(
image_
.
channels
()
==
1
)
{
...
...
modules/ximgproc/perf/perf_adaptive_manifold.cpp
View file @
b8de57f8
...
...
@@ -29,9 +29,7 @@ PERF_TEST_P( AdaptiveManifoldPerfTest, perf,
Mat
src
(
sz
,
CV_MAKE_TYPE
(
depth
,
srcCnNum
));
Mat
dst
(
sz
,
CV_MAKE_TYPE
(
depth
,
srcCnNum
));
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
declare
.
in
(
joint
,
src
,
WARMUP_RNG
).
out
(
dst
).
tbb_threads
(
cv
::
getNumberOfCPUs
());
declare
.
in
(
joint
,
src
,
WARMUP_RNG
).
out
(
dst
);
double
sigma_s
=
16
;
double
sigma_r
=
0.5
;
...
...
modules/ximgproc/perf/perf_bilateral_texture_filter.cpp
View file @
b8de57f8
...
...
@@ -29,8 +29,7 @@ PERF_TEST_P(BilateralTextureFilterTest, perf,
Mat
src
(
sz
,
CV_MAKE_TYPE
(
depth
,
srcCn
));
Mat
dst
(
sz
,
src
.
type
());
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
).
tbb_threads
(
cv
::
getNumberOfCPUs
());
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
TEST_CYCLE_N
(
1
)
{
...
...
modules/ximgproc/perf/perf_disparity_wls_filter.cpp
View file @
b8de57f8
...
...
@@ -41,7 +41,6 @@ PERF_TEST_P( DisparityWLSFilterPerfTest, perf, Combine(GuideTypes::all(), SrcTyp
ROI
=
Rect
(
ROI
.
x
/
2
,
ROI
.
y
/
2
,
ROI
.
width
/
2
,
ROI
.
height
/
2
);
}
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
TEST_CYCLE_N
(
10
)
{
Ptr
<
DisparityWLSFilter
>
wls_filter
=
createDisparityWLSFilterGeneric
(
use_conf
);
...
...
modules/ximgproc/perf/perf_domain_transform.cpp
View file @
b8de57f8
...
...
@@ -34,9 +34,8 @@ PERF_TEST_P( DomainTransformTest, perf,
Mat
src
(
size
,
srcType
);
Mat
dst
(
size
,
srcType
);
declare
.
in
(
guide
,
src
,
WARMUP_RNG
).
out
(
dst
)
.
tbb_threads
(
cv
::
getNumberOfCPUs
())
;
declare
.
in
(
guide
,
src
,
WARMUP_RNG
).
out
(
dst
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
TEST_CYCLE_N
(
5
)
{
dtFilter
(
guide
,
src
,
dst
,
sigmaSpatial
,
sigmaColor
,
dtfType
);
...
...
modules/ximgproc/perf/perf_fgs_filter.cpp
View file @
b8de57f8
...
...
@@ -24,9 +24,8 @@ PERF_TEST_P( FGSFilterPerfTest, perf, Combine(GuideTypes::all(), SrcTypes::all()
Mat
src
(
sz
,
srcType
);
Mat
dst
(
sz
,
srcType
);
declare
.
in
(
guide
,
src
,
WARMUP_RNG
).
out
(
dst
)
.
tbb_threads
(
cv
::
getNumberOfCPUs
())
;
declare
.
in
(
guide
,
src
,
WARMUP_RNG
).
out
(
dst
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
TEST_CYCLE_N
(
10
)
{
double
lambda
=
rng
.
uniform
(
500.0
,
10000.0
);
...
...
modules/ximgproc/perf/perf_guided_filter.cpp
View file @
b8de57f8
...
...
@@ -24,9 +24,8 @@ PERF_TEST_P( GuidedFilterPerfTest, perf, Combine(GuideTypes::all(), SrcTypes::al
Mat
src
(
sz
,
srcType
);
Mat
dst
(
sz
,
srcType
);
declare
.
in
(
guide
,
src
,
WARMUP_RNG
).
out
(
dst
)
.
tbb_threads
(
cv
::
getNumberOfCPUs
())
;
declare
.
in
(
guide
,
src
,
WARMUP_RNG
).
out
(
dst
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
TEST_CYCLE_N
(
3
)
{
int
radius
=
rng
.
uniform
(
5
,
30
);
...
...
modules/ximgproc/perf/perf_l0_smooth.cpp
View file @
b8de57f8
...
...
@@ -23,8 +23,7 @@ PERF_TEST_P(L0SmoothTest, perf,
Mat
src
(
sz
,
CV_MAKE_TYPE
(
depth
,
srcCn
));
Mat
dst
(
sz
,
src
.
type
());
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
).
tbb_threads
(
cv
::
getNumberOfCPUs
());
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
RNG
rnd
(
sz
.
height
+
depth
+
srcCn
);
double
lambda
=
rnd
.
uniform
(
0.01
,
0.05
);
...
...
modules/ximgproc/perf/perf_rolling_guidance_filter.cpp
View file @
b8de57f8
...
...
@@ -25,8 +25,7 @@ PERF_TEST_P(RollingGuidanceFilterTest, perf,
Mat
src
(
sz
,
CV_MAKE_TYPE
(
depth
,
srcCn
));
Mat
dst
(
sz
,
src
.
type
());
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
).
tbb_threads
(
cv
::
getNumberOfCPUs
());
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
RNG
rnd
(
cvRound
(
10
*
sigmaS
)
+
sz
.
height
+
depth
+
srcCn
);
double
sigmaC
=
rnd
.
uniform
(
1.0
,
255.0
);
...
...
modules/ximgproc/perf/perf_weighted_median_filter.cpp
View file @
b8de57f8
...
...
@@ -34,8 +34,7 @@ PERF_TEST_P(WeightedMedianFilterTest, perf,
Mat
src
(
sz
,
CV_MAKE_TYPE
(
srcDepth
,
srcCn
));
Mat
dst
(
sz
,
src
.
type
());
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
declare
.
in
(
joint
,
src
,
WARMUP_RNG
).
out
(
dst
).
tbb_threads
(
cv
::
getNumberOfCPUs
());
declare
.
in
(
joint
,
src
,
WARMUP_RNG
).
out
(
dst
);
TEST_CYCLE_N
(
1
)
{
...
...
modules/ximgproc/perf/pref_joint_bilateral_filter.cpp
View file @
b8de57f8
...
...
@@ -29,8 +29,7 @@ PERF_TEST_P(JointBilateralFilterTest, perf,
Mat
src
(
sz
,
CV_MAKE_TYPE
(
depth
,
srcCn
));
Mat
dst
(
sz
,
src
.
type
());
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
declare
.
in
(
joint
,
src
,
WARMUP_RNG
).
out
(
dst
).
tbb_threads
(
cv
::
getNumberOfCPUs
());
declare
.
in
(
joint
,
src
,
WARMUP_RNG
).
out
(
dst
);
RNG
rnd
(
cvRound
(
10
*
sigmaS
)
+
sz
.
height
+
depth
+
jCn
+
srcCn
);
double
sigmaC
=
rnd
.
uniform
(
1.0
,
255.0
);
...
...
modules/ximgproc/samples/graphsegmentation_demo.cpp
View file @
b8de57f8
...
...
@@ -91,9 +91,6 @@ int main(int argc, char** argv) {
return
-
1
;
}
setUseOptimized
(
true
);
setNumThreads
(
8
);
Ptr
<
GraphSegmentation
>
gs
=
createGraphSegmentation
();
if
(
argc
>
3
)
...
...
modules/ximgproc/samples/live_demo.cpp
View file @
b8de57f8
...
...
@@ -158,7 +158,6 @@ void changeModeCallback(int state, void *filter)
void
changeNumberOfCpuCallback
(
int
count
,
void
*
)
{
count
=
std
::
max
(
1
,
count
);
cv
::
setNumThreads
(
count
);
g_numberOfCPUs
=
count
;
}
...
...
@@ -188,7 +187,6 @@ int main()
displayOverlay
(
"Demo"
,
"Press Ctrl+P to show property window"
,
5000
);
//Thread trackbar
cv
::
setNumThreads
(
g_numberOfCPUs
);
//speedup filtering
createTrackbar
(
"Threads"
,
String
(),
&
g_numberOfCPUs
,
cv
::
getNumberOfCPUs
(),
changeNumberOfCpuCallback
);
//Buttons to choose different modes
...
...
@@ -219,6 +217,8 @@ int main()
cap
>>
rawFrame
;
}
while
(
rawFrame
.
empty
());
cv
::
setNumThreads
(
g_numberOfCPUs
);
//speedup filtering
splitScreen
(
rawFrame
,
outputFrame
,
srcFrame
,
processedFrame
);
g_filterOp
(
srcFrame
,
processedFrame
);
...
...
modules/ximgproc/samples/selectivesearchsegmentation_demo.cpp
View file @
b8de57f8
...
...
@@ -59,11 +59,6 @@ int main(int argc, char** argv) {
return
-
1
;
}
setUseOptimized
(
true
);
setNumThreads
(
8
);
std
::
srand
((
int
)
std
::
time
(
0
));
Mat
img
=
imread
(
argv
[
1
]);
Ptr
<
SelectiveSearchSegmentation
>
gs
=
createSelectiveSearchSegmentation
();
...
...
modules/ximgproc/test/test_adaptive_manifold.cpp
View file @
b8de57f8
...
...
@@ -29,8 +29,6 @@ TEST(AdaptiveManifoldTest, SplatSurfaceAccuracy)
{
RNG
rnd
(
0
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
Size
sz
(
rnd
.
uniform
(
512
,
1024
),
rnd
.
uniform
(
512
,
1024
));
...
...
@@ -90,8 +88,6 @@ TEST(AdaptiveManifoldTest, AuthorsReferenceAccuracy)
Mat
srcImg
=
imread
(
getOpenCVExtraDir
()
+
srcImgPath
);
ASSERT_TRUE
(
!
srcImg
.
empty
());
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
Mat
refRes
=
imread
(
getOpenCVExtraDir
()
+
refPaths
[
i
]);
...
...
@@ -148,13 +144,16 @@ TEST_P(AdaptiveManifoldRefImplTest, RefImplAccuracy)
resize
(
guide
,
guide
,
dstSize
,
0
,
0
,
INTER_LINEAR_EXACT
);
resize
(
src
,
src
,
dstSize
,
0
,
0
,
INTER_LINEAR_EXACT
);
int
nThreads
=
cv
::
getNumThreads
();
if
(
nThreads
==
1
)
throw
SkipTestException
(
"Single thread environment"
);
for
(
int
iter
=
0
;
iter
<
4
;
iter
++
)
{
double
sigma_s
=
rnd
.
uniform
(
1.0
,
50.0
);
double
sigma_r
=
rnd
.
uniform
(
0.1
,
0.9
);
bool
adjust_outliers
=
(
iter
%
2
==
0
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
()
);
cv
::
setNumThreads
(
nThreads
);
Mat
res
;
amFilter
(
guide
,
src
,
res
,
sigma_s
,
sigma_r
,
adjust_outliers
);
...
...
modules/ximgproc/test/test_bilateral_texture_filter.cpp
View file @
b8de57f8
...
...
@@ -66,9 +66,12 @@ TEST_P(BilateralTextureFilterTest, MultiThreadReproducibility)
else
randu
(
src
,
0.0
f
,
1.0
f
);
int
nThreads
=
cv
::
getNumThreads
();
if
(
nThreads
==
1
)
throw
SkipTestException
(
"Single thread environment"
);
for
(
int
iter
=
0
;
iter
<=
loopsCount
;
iter
++
)
{
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
()
);
cv
::
setNumThreads
(
nThreads
);
Mat
resMultiThread
;
bilateralTextureFilter
(
src
,
resMultiThread
,
fr
,
1
,
sigmaAlpha
,
sigmaAvg
);
...
...
modules/ximgproc/test/test_disparity_wls_filter.cpp
View file @
b8de57f8
...
...
@@ -39,7 +39,6 @@ TEST(DisparityWLSFilterTest, ReferenceAccuracy)
double
ref_MSE
=
(
double
)
reference_res
[
"MSE_after"
];
double
ref_BadPercent
=
(
double
)
reference_res
[
"BadPercent_after"
];
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
Mat
res
;
Ptr
<
DisparityWLSFilter
>
wls_filter
=
createDisparityWLSFilterGeneric
(
true
);
...
...
@@ -88,6 +87,9 @@ TEST_P(DisparityWLSFilterTest, MultiThreadReproducibility)
ROI
=
Rect
(
ROI
.
x
/
2
,
ROI
.
y
/
2
,
ROI
.
width
/
2
,
ROI
.
height
/
2
);
}
int
nThreads
=
cv
::
getNumThreads
();
if
(
nThreads
==
1
)
throw
SkipTestException
(
"Single thread environment"
);
for
(
int
iter
=
0
;
iter
<=
loopsCount
;
iter
++
)
{
double
lambda
=
rng
.
uniform
(
100.0
,
10000.0
);
...
...
@@ -97,7 +99,7 @@ TEST_P(DisparityWLSFilterTest, MultiThreadReproducibility)
wls_filter
->
setLambda
(
lambda
);
wls_filter
->
setSigmaColor
(
sigma
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
()
);
cv
::
setNumThreads
(
nThreads
);
Mat
resMultiThread
;
wls_filter
->
filter
(
left_disp
,
left
,
resMultiThread
,
right_disp
,
ROI
);
...
...
modules/ximgproc/test/test_domain_transform.cpp
View file @
b8de57f8
...
...
@@ -100,12 +100,15 @@ TEST_P(DomainTransformTest, MultiThreadReproducibility)
Mat
guide
=
convertTypeAndSize
(
original
,
guideType
,
size
);
Mat
src
=
convertTypeAndSize
(
original
,
srcType
,
size
);
int
nThreads
=
cv
::
getNumThreads
();
if
(
nThreads
==
1
)
throw
SkipTestException
(
"Single thread environment"
);
for
(
int
iter
=
0
;
iter
<=
loopsCount
;
iter
++
)
{
double
ss
=
rng
.
uniform
(
0.0
,
100.0
);
double
sc
=
rng
.
uniform
(
0.0
,
100.0
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
()
);
cv
::
setNumThreads
(
nThreads
);
Mat
resMultithread
;
dtFilter
(
guide
,
src
,
resMultithread
,
ss
,
sc
,
mode
);
...
...
@@ -194,7 +197,6 @@ TEST(DomainTransformTest, AuthorReferenceAccuracy)
ASSERT_FALSE
(
ref_IC
.
empty
());
ASSERT_FALSE
(
ref_RF
.
empty
());
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
Mat
res_NC
,
res_IC
,
res_RF
;
dtFilter
(
src
,
src
,
res_NC
,
ss
,
sc
,
DTF_NC
);
dtFilter
(
src
,
src
,
res_IC
,
ss
,
sc
,
DTF_IC
);
...
...
modules/ximgproc/test/test_fgs_filter.cpp
View file @
b8de57f8
...
...
@@ -55,7 +55,6 @@ TEST(FastGlobalSmootherTest, ReferenceAccuracy)
ASSERT_FALSE
(
src
.
empty
());
ASSERT_FALSE
(
ref
.
empty
());
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
Mat
res
;
fastGlobalSmootherFilter
(
src
,
src
,
res
,
1000.0
,
10.0
);
...
...
@@ -90,12 +89,15 @@ TEST_P(FastGlobalSmootherTest, MultiThreadReproducibility)
else
randu
(
src
,
-
100000.0
f
,
100000.0
f
);
int
nThreads
=
cv
::
getNumThreads
();
if
(
nThreads
==
1
)
throw
SkipTestException
(
"Single thread environment"
);
for
(
int
iter
=
0
;
iter
<=
loopsCount
;
iter
++
)
{
double
lambda
=
rng
.
uniform
(
100.0
,
10000.0
);
double
sigma
=
rng
.
uniform
(
1.0
,
100.0
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
()
);
cv
::
setNumThreads
(
nThreads
);
Mat
resMultiThread
;
fastGlobalSmootherFilter
(
guide
,
src
,
resMultiThread
,
lambda
,
sigma
);
...
...
modules/ximgproc/test/test_guided_filter.cpp
View file @
b8de57f8
...
...
@@ -324,12 +324,15 @@ TEST_P(GuidedFilterTest, accuracy)
guide
=
convertTypeAndSize
(
guide
,
CV_MAKE_TYPE
(
guide
.
depth
(),
guideCnNum
),
dstSize
);
src
=
convertTypeAndSize
(
src
,
CV_MAKE_TYPE
(
src
.
depth
(),
srcCnNum
),
dstSize
);
int
nThreads
=
cv
::
getNumThreads
();
if
(
nThreads
==
1
)
throw
SkipTestException
(
"Single thread environment"
);
for
(
int
iter
=
0
;
iter
<
2
;
iter
++
)
{
int
radius
=
rng
.
uniform
(
0
,
50
);
double
eps
=
rng
.
uniform
(
0.0
,
SQR
(
255.0
));
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
()
);
cv
::
setNumThreads
(
nThreads
);
Mat
res
;
Ptr
<
GuidedFilter
>
gf
=
createGuidedFilter
(
guide
,
radius
,
eps
);
gf
->
filter
(
src
,
res
);
...
...
modules/ximgproc/test/test_joint_bilateral_filter.cpp
View file @
b8de57f8
...
...
@@ -192,10 +192,8 @@ TEST_P(JointBilateralFilterTest_NaiveRef, Accuracy)
Mat
resNaive
;
jointBilateralFilterNaive
(
joint
,
src
,
resNaive
,
0
,
sigmaC
,
sigmaS
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
Mat
res
;
jointBilateralFilter
(
joint
,
src
,
res
,
0
,
sigmaC
,
sigmaS
);
cv
::
setNumThreads
(
1
);
checkSimilarity
(
res
,
resNaive
);
}
...
...
@@ -226,8 +224,6 @@ TEST_P(JointBilateralFilterTest_BilateralRef, Accuracy)
RNG
rnd
(
cvRound
(
10
*
sigmaS
)
+
srcPath
.
length
()
+
srcType
+
src
.
rows
);
double
sigmaC
=
rnd
.
uniform
(
0.0
,
255.0
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
Mat
resRef
;
bilateralFilter
(
src
,
resRef
,
0
,
sigmaC
,
sigmaS
);
...
...
modules/ximgproc/test/test_l0_smooth.cpp
View file @
b8de57f8
...
...
@@ -57,12 +57,15 @@ TEST_P(L0SmoothTest, MultiThreadReproducibility)
randu
(
src
,
-
100000.0
f
,
100000.0
f
);
int
nThreads
=
cv
::
getNumThreads
();
if
(
nThreads
==
1
)
throw
SkipTestException
(
"Single thread environment"
);
for
(
int
iter
=
0
;
iter
<=
loopsCount
;
iter
++
)
{
double
lambda
=
rng
.
uniform
(
0.01
,
0.05
);
double
kappa
=
rng
.
uniform
(
1.5
,
5.0
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
()
);
cv
::
setNumThreads
(
nThreads
);
Mat
resMultiThread
;
l0Smooth
(
src
,
resMultiThread
,
lambda
,
kappa
);
...
...
modules/ximgproc/test/test_rolling_guidance_filter.cpp
View file @
b8de57f8
...
...
@@ -104,12 +104,15 @@ TEST_P(RollingGuidanceFilterTest, MultiThreadReproducibility)
else
randu
(
src
,
-
100000.0
f
,
100000.0
f
);
int
nThreads
=
cv
::
getNumThreads
();
if
(
nThreads
==
1
)
throw
SkipTestException
(
"Single thread environment"
);
for
(
int
iter
=
0
;
iter
<=
loopsCount
;
iter
++
)
{
int
iterNum
=
int
(
rnd
.
uniform
(
1.0
,
5.0
));
double
sigmaC
=
rnd
.
uniform
(
1.0
,
255.0
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
()
);
cv
::
setNumThreads
(
nThreads
);
Mat
resMultiThread
;
rollingGuidanceFilter
(
src
,
resMultiThread
,
-
1
,
sigmaC
,
sigmaS
,
iterNum
);
...
...
@@ -150,8 +153,6 @@ TEST_P(RollingGuidanceFilterTest_BilateralRef, Accuracy)
RNG
rnd
(
0
);
double
sigmaC
=
rnd
.
uniform
(
0.0
,
255.0
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
Mat
resRef
;
bilateralFilter
(
src
,
resRef
,
0
,
sigmaC
,
sigmaS
);
...
...
modules/ximgproc/test/test_sparse_match_interpolator.cpp
View file @
b8de57f8
...
...
@@ -81,7 +81,6 @@ TEST(InterpolatorTest, ReferenceAccuracy)
to_points
.
push_back
(
Point2f
(
to_x
,
to_y
));
}
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
Mat
res_flow
;
Ptr
<
EdgeAwareInterpolator
>
interpolator
=
createEdgeAwareInterpolator
();
...
...
@@ -123,6 +122,9 @@ TEST_P(InterpolatorTest, MultiThreadReproducibility)
to_points
.
push_back
(
Point2f
(
rng
.
uniform
(
0.01
f
,(
float
)
size
.
width
-
1.01
f
),
rng
.
uniform
(
0.01
f
,(
float
)
size
.
height
-
1.01
f
)));
}
int
nThreads
=
cv
::
getNumThreads
();
if
(
nThreads
==
1
)
throw
SkipTestException
(
"Single thread environment"
);
for
(
int
iter
=
0
;
iter
<=
loopsCount
;
iter
++
)
{
int
K
=
rng
.
uniform
(
4
,
512
);
...
...
@@ -137,7 +139,7 @@ TEST_P(InterpolatorTest, MultiThreadReproducibility)
interpolator
->
setFGSLambda
(
FGSlambda
);
interpolator
->
setFGSSigma
(
FGSsigma
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
()
);
cv
::
setNumThreads
(
nThreads
);
Mat
resMultiThread
;
interpolator
->
interpolate
(
from
,
from_points
,
Mat
(),
to_points
,
resMultiThread
);
...
...
modules/ximgproc/test/test_weighted_median_filter.cpp
View file @
b8de57f8
...
...
@@ -52,7 +52,6 @@ TEST(WeightedMedianFilterTest, ReferenceAccuracy)
ASSERT_FALSE
(
src
.
empty
());
ASSERT_FALSE
(
ref
.
empty
());
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
Mat
res
;
weightedMedianFilter
(
src
,
src
,
res
,
7
);
...
...
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