Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
7f63b31c
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7f63b31c
编写于
3月 29, 2018
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avoid calling of setNumThreads() to respect user settings
上级
7dc88f26
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
19 deletion
+15
-19
modules/calib3d/perf/perf_stereosgbm.cpp
modules/calib3d/perf/perf_stereosgbm.cpp
+0
-1
modules/calib3d/test/test_solvepnp_ransac.cpp
modules/calib3d/test/test_solvepnp_ransac.cpp
+2
-0
modules/imgproc/src/connectedcomponents.cpp
modules/imgproc/src/connectedcomponents.cpp
+13
-18
未找到文件。
modules/calib3d/perf/perf_stereosgbm.cpp
浏览文件 @
7f63b31c
...
...
@@ -67,7 +67,6 @@ PERF_TEST_P( TestStereoCorresp, DISABLED_TooLongInDebug_SGBM, Combine(Values(Siz
MakeArtificialExample
(
rng
,
src_left
,
src_right
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
int
wsize
=
3
;
int
P1
=
8
*
src_left
.
channels
()
*
wsize
*
wsize
;
TEST_CYCLE
()
...
...
modules/calib3d/test/test_solvepnp_ransac.cpp
浏览文件 @
7f63b31c
...
...
@@ -382,6 +382,7 @@ TEST(Calib3d_SolvePnPRansac, concurrency)
Mat
rvec1
,
rvec2
;
Mat
tvec1
,
tvec2
;
int
threads
=
getNumThreads
();
{
// limit concurrency to get deterministic result
theRNG
().
state
=
20121010
;
...
...
@@ -390,6 +391,7 @@ TEST(Calib3d_SolvePnPRansac, concurrency)
}
{
setNumThreads
(
threads
);
Mat
rvec
;
Mat
tvec
;
// parallel executions
...
...
modules/imgproc/src/connectedcomponents.cpp
浏览文件 @
7f63b31c
...
...
@@ -579,9 +579,6 @@ namespace cv{
CV_Assert
(
img
.
cols
==
imgLabels
.
cols
);
CV_Assert
(
connectivity
==
8
||
connectivity
==
4
);
const
int
nThreads
=
cv
::
getNumberOfCPUs
();
cv
::
setNumThreads
(
nThreads
);
const
int
h
=
img
.
rows
;
const
int
w
=
img
.
cols
;
...
...
@@ -606,12 +603,13 @@ namespace cv{
P
[
0
]
=
0
;
cv
::
Range
range
(
0
,
h
);
const
double
nParallelStripes
=
std
::
max
(
1
,
std
::
min
(
h
/
2
,
getNumThreads
()
*
4
));
LabelT
nLabels
=
1
;
if
(
connectivity
==
8
){
//First scan, each thread works with chunk of img.rows/nThreads rows
//e.g. 300 rows, 4 threads -> each chunks is composed of 75 rows
cv
::
parallel_for_
(
range
,
FirstScan8Connectivity
(
img
,
imgLabels
,
P
,
chunksSizeAndLabels
),
nThreads
);
//First scan
cv
::
parallel_for_
(
range
,
FirstScan8Connectivity
(
img
,
imgLabels
,
P
,
chunksSizeAndLabels
),
nParallelStripes
);
//merge labels of different chunks
mergeLabels8Connectivity
(
imgLabels
,
P
,
chunksSizeAndLabels
);
...
...
@@ -621,9 +619,8 @@ namespace cv{
}
}
else
{
//First scan, each thread works with chunk of img.rows/nThreads rows
//e.g. 300 rows, 4 threads -> each chunks is composed of 75 rows
cv
::
parallel_for_
(
range
,
FirstScan4Connectivity
(
img
,
imgLabels
,
P
,
chunksSizeAndLabels
),
nThreads
);
//First scan
cv
::
parallel_for_
(
range
,
FirstScan4Connectivity
(
img
,
imgLabels
,
P
,
chunksSizeAndLabels
),
nParallelStripes
);
//merge labels of different chunks
mergeLabels4Connectivity
(
imgLabels
,
P
,
chunksSizeAndLabels
);
...
...
@@ -638,7 +635,7 @@ namespace cv{
sop
.
init
(
nLabels
);
//Second scan
cv
::
parallel_for_
(
range
,
SecondScan
(
imgLabels
,
P
,
sop
,
sopArray
,
nLabels
),
n
Thread
s
);
cv
::
parallel_for_
(
range
,
SecondScan
(
imgLabels
,
P
,
sop
,
sopArray
,
nLabels
),
n
ParallelStripe
s
);
StatsOp
::
mergeStats
(
imgLabels
,
sopArray
,
sop
,
nLabels
);
sop
.
finish
();
...
...
@@ -2530,9 +2527,6 @@ namespace cv{
CV_Assert
(
img
.
cols
==
imgLabels
.
cols
);
CV_Assert
(
connectivity
==
8
);
const
int
nThreads
=
cv
::
getNumberOfCPUs
();
cv
::
setNumThreads
(
nThreads
);
const
int
h
=
img
.
rows
;
const
int
w
=
img
.
cols
;
...
...
@@ -2556,10 +2550,11 @@ namespace cv{
P
[
0
]
=
0
;
cv
::
Range
range
(
0
,
h
);
const
double
nParallelStripes
=
std
::
max
(
1
,
std
::
min
(
h
/
2
,
getNumThreads
()
*
4
));
//First scan, each thread works with chunk of img.rows/nThreads rows
//e.g. 300 rows, 4 threads -> each chunks is composed of 75 rows
cv
::
parallel_for_
(
range
,
FirstScan
(
img
,
imgLabels
,
P
,
chunksSizeAndLabels
),
n
Thread
s
);
cv
::
parallel_for_
(
range
,
FirstScan
(
img
,
imgLabels
,
P
,
chunksSizeAndLabels
),
n
ParallelStripe
s
);
//merge labels of different chunks
mergeLabels
(
img
,
imgLabels
,
P
,
chunksSizeAndLabels
);
...
...
@@ -2574,7 +2569,7 @@ namespace cv{
sop
.
init
(
nLabels
);
//Second scan
cv
::
parallel_for_
(
range
,
SecondScan
(
img
,
imgLabels
,
P
,
sop
,
sopArray
,
nLabels
),
n
Thread
s
);
cv
::
parallel_for_
(
range
,
SecondScan
(
img
,
imgLabels
,
P
,
sop
,
sopArray
,
nLabels
),
n
ParallelStripe
s
);
StatsOp
::
mergeStats
(
imgLabels
,
sopArray
,
sop
,
nLabels
);
sop
.
finish
();
...
...
@@ -3936,12 +3931,12 @@ namespace cv{
int
lDepth
=
L
.
depth
();
int
iDepth
=
I
.
depth
();
const
char
*
currentParallelFramework
=
cv
::
currentParallelFramework
();
const
int
n
umberOfCPUs
=
cv
::
getNumberOfCPU
s
();
const
int
n
Threads
=
cv
::
getNumThread
s
();
CV_Assert
(
iDepth
==
CV_8U
||
iDepth
==
CV_8S
);
//Run parallel labeling only if the rows of the image are at least twice the number
returned by getNumberOfCPU
s
const
bool
is_parallel
=
currentParallelFramework
!=
NULL
&&
n
umberOfCPUs
>
1
&&
L
.
rows
/
numberOfCPU
s
>=
2
;
//Run parallel labeling only if the rows of the image are at least twice the number
of available thread
s
const
bool
is_parallel
=
currentParallelFramework
!=
NULL
&&
n
Threads
>
1
&&
L
.
rows
/
nThread
s
>=
2
;
if
(
ccltype
==
CCL_WU
||
connectivity
==
4
){
// Wu algorithm is used
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录