Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
051aa4cb
O
Opencv
项目概览
Greenplum
/
Opencv
10 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
051aa4cb
编写于
2月 22, 2013
作者:
A
Andrey Kamaev
提交者:
OpenCV Buildbot
2月 22, 2013
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #530 from bitwangyaoyao:2.4_fixEqHist
上级
58f546dd
78102541
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
7 deletion
+14
-7
modules/ocl/src/imgproc.cpp
modules/ocl/src/imgproc.cpp
+5
-3
modules/ocl/src/kernels/imgproc_histogram.cl
modules/ocl/src/kernels/imgproc_histogram.cl
+9
-4
未找到文件。
modules/ocl/src/imgproc.cpp
浏览文件 @
051aa4cb
...
...
@@ -12,6 +12,7 @@
//
// Copyright (C) 2010-2012, Institute Of Software Chinese Academy Of Science, all rights reserved.
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// @Authors
...
...
@@ -23,6 +24,7 @@
// Zhang Ying, zhangying913@gmail.com
// Xu Pang, pangxu010@163.com
// Wu Zailong, bullet@yeah.net
// Wenju He, wenju@multicorewareinc.com
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
...
...
@@ -1524,7 +1526,7 @@ namespace cv
mat_dst
.
create
(
mat_src
.
rows
,
mat_src
.
cols
,
CV_8UC1
);
oclMat
mat_hist
(
1
,
256
,
CV_32SC1
);
//mat_hist.setTo(0);
calcHist
(
mat_src
,
mat_hist
);
Context
*
clCxt
=
mat_src
.
clCxt
;
...
...
@@ -1533,10 +1535,10 @@ namespace cv
size_t
globalThreads
[
3
]
=
{
256
,
1
,
1
};
oclMat
lut
(
1
,
256
,
CV_8UC1
);
vector
<
pair
<
size_t
,
const
void
*>
>
args
;
float
scale
=
255.
f
/
(
mat_src
.
rows
*
mat_src
.
cols
)
;
int
total
=
mat_src
.
rows
*
mat_src
.
cols
;
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
lut
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
mat_hist
.
data
));
args
.
push_back
(
make_pair
(
sizeof
(
cl_float
),
(
void
*
)
&
scale
));
args
.
push_back
(
make_pair
(
sizeof
(
int
),
(
void
*
)
&
total
));
openCLExecuteKernel
(
clCxt
,
&
imgproc_histogram
,
kernelName
,
globalThreads
,
localThreads
,
args
,
-
1
,
-
1
);
LUT
(
mat_src
,
lut
,
mat_dst
);
}
...
...
modules/ocl/src/kernels/imgproc_histogram.cl
浏览文件 @
051aa4cb
...
...
@@ -3,12 +3,14 @@
//
//
Copyright
(
C
)
2010-2012,
Institute
Of
Software
Chinese
Academy
Of
Science,
all
rights
reserved.
//
Copyright
(
C
)
2010-2012,
Advanced
Micro
Devices,
Inc.,
all
rights
reserved.
//
Copyright
(
C
)
2010-2012,
Multicoreware,
Inc.,
all
rights
reserved.
//
Third
party
copyrights
are
property
of
their
respective
owners.
//
//
@Authors
//
Niko
Li,
newlife20080214@gmail.com
//
Jia
Haipeng,
jiahaipeng95@gmail.com
//
Xu
Pang,
pangxu010@163.com
//
Wenju
He,
wenju@multicorewareinc.com
//
Redistribution
and
use
in
source
and
binary
forms,
with
or
without
modification,
//
are
permitted
provided
that
the
following
conditions
are
met:
//
...
...
@@ -189,24 +191,27 @@ __kernel __attribute__((reqd_work_group_size(256,1,1)))void merge_hist(__global
__kernel
__attribute__
((
reqd_work_group_size
(
256
,
1
,
1
)))
void
calLUT
(
__global
uchar
*
dst,
__constant
int
*
hist,
float
scale
)
int
total
)
{
int
lid
=
get_local_id
(
0
)
;
__local
int
sumhist[HISTOGRAM256_BIN_COUNT]
;
//__local
uchar
lut[HISTOGRAM256_BIN_COUNT+1]
;
__local
int
sumhist[HISTOGRAM256_BIN_COUNT+1]
;
sumhist[lid]=hist[lid]
;
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
if
(
lid==0
)
{
int
sum
=
0
;
for
(
int
i=0
;i<HISTOGRAM256_BIN_COUNT;i++)
int
i
=
0
;
while
(
!sumhist[i]
)
++i
;
sumhist[HISTOGRAM256_BIN_COUNT]
=
sumhist[i]
;
for
(
sumhist[i++]
=
0
; i<HISTOGRAM256_BIN_COUNT; i++)
{
sum+=sumhist[i]
;
sumhist[i]=sum
;
}
}
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
float
scale
=
255.f/
(
total
-
sumhist[HISTOGRAM256_BIN_COUNT]
)
;
dst[lid]=
lid
==
0
?
0
:
convert_uchar_sat
(
convert_float
(
sumhist[lid]
)
*scale
)
;
}
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录