Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
74bc8d35
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,发现更多精彩内容 >>
提交
74bc8d35
编写于
1月 05, 2020
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16265 from JanuszL:fix_bgr
上级
40ac72a8
178c4810
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
21 deletion
+21
-21
modules/imgcodecs/src/utils.cpp
modules/imgcodecs/src/utils.cpp
+21
-21
未找到文件。
modules/imgcodecs/src/utils.cpp
浏览文件 @
74bc8d35
...
...
@@ -56,65 +56,65 @@ int validateToInt(size_t sz)
#define cG (int)(0.587*(1 << SCALE) + 0.5)
#define cB ((1 << SCALE) - cR - cG)
void
icvCvt_BGR2Gray_8u_C3C1R
(
const
uchar
*
rgb
,
int
rgb
_step
,
void
icvCvt_BGR2Gray_8u_C3C1R
(
const
uchar
*
bgr
,
int
bgr
_step
,
uchar
*
gray
,
int
gray_step
,
Size
size
,
int
_swap_rb
)
{
int
i
;
for
(
;
size
.
height
--
;
gray
+=
gray_step
)
{
short
c
RGB0
=
cR
;
short
c
RGB2
=
cB
;
if
(
_swap_rb
)
std
::
swap
(
c
RGB0
,
cRGB
2
);
for
(
i
=
0
;
i
<
size
.
width
;
i
++
,
rgb
+=
3
)
short
c
BGR0
=
cB
;
short
c
BGR2
=
cR
;
if
(
_swap_rb
)
std
::
swap
(
c
BGR0
,
cBGR
2
);
for
(
i
=
0
;
i
<
size
.
width
;
i
++
,
bgr
+=
3
)
{
int
t
=
descale
(
rgb
[
0
]
*
cRGB0
+
rgb
[
1
]
*
cG
+
rgb
[
2
]
*
cRGB
2
,
SCALE
);
int
t
=
descale
(
bgr
[
0
]
*
cBGR0
+
bgr
[
1
]
*
cG
+
bgr
[
2
]
*
cBGR
2
,
SCALE
);
gray
[
i
]
=
(
uchar
)
t
;
}
rgb
+=
rgb
_step
-
size
.
width
*
3
;
bgr
+=
bgr
_step
-
size
.
width
*
3
;
}
}
void
icvCvt_BGRA2Gray_16u_CnC1R
(
const
ushort
*
rgb
,
int
rgb
_step
,
void
icvCvt_BGRA2Gray_16u_CnC1R
(
const
ushort
*
bgr
,
int
bgr
_step
,
ushort
*
gray
,
int
gray_step
,
Size
size
,
int
ncn
,
int
_swap_rb
)
{
int
i
;
for
(
;
size
.
height
--
;
gray
+=
gray_step
)
{
short
c
RGB0
=
cR
;
short
c
RGB2
=
cB
;
if
(
_swap_rb
)
std
::
swap
(
c
RGB0
,
cRGB
2
);
for
(
i
=
0
;
i
<
size
.
width
;
i
++
,
rgb
+=
ncn
)
short
c
BGR0
=
cB
;
short
c
BGR2
=
cR
;
if
(
_swap_rb
)
std
::
swap
(
c
BGR0
,
cBGR
2
);
for
(
i
=
0
;
i
<
size
.
width
;
i
++
,
bgr
+=
ncn
)
{
int
t
=
descale
(
rgb
[
0
]
*
cRGB0
+
rgb
[
1
]
*
cG
+
rgb
[
2
]
*
cRGB
2
,
SCALE
);
int
t
=
descale
(
bgr
[
0
]
*
cBGR0
+
bgr
[
1
]
*
cG
+
bgr
[
2
]
*
cBGR
2
,
SCALE
);
gray
[
i
]
=
(
ushort
)
t
;
}
rgb
+=
rgb
_step
-
size
.
width
*
ncn
;
bgr
+=
bgr
_step
-
size
.
width
*
ncn
;
}
}
void
icvCvt_BGRA2Gray_8u_C4C1R
(
const
uchar
*
rgb
a
,
int
rgba_step
,
void
icvCvt_BGRA2Gray_8u_C4C1R
(
const
uchar
*
bgr
a
,
int
rgba_step
,
uchar
*
gray
,
int
gray_step
,
Size
size
,
int
_swap_rb
)
{
int
i
;
for
(
;
size
.
height
--
;
gray
+=
gray_step
)
{
short
c
RGB0
=
cR
;
short
c
RGB2
=
cB
;
if
(
_swap_rb
)
std
::
swap
(
c
RGB0
,
cRGB
2
);
for
(
i
=
0
;
i
<
size
.
width
;
i
++
,
rgb
a
+=
4
)
short
c
BGR0
=
cB
;
short
c
BGR2
=
cR
;
if
(
_swap_rb
)
std
::
swap
(
c
BGR0
,
cBGR
2
);
for
(
i
=
0
;
i
<
size
.
width
;
i
++
,
bgr
a
+=
4
)
{
int
t
=
descale
(
rgba
[
0
]
*
cRGB0
+
rgba
[
1
]
*
cG
+
rgba
[
2
]
*
cRGB
2
,
SCALE
);
int
t
=
descale
(
bgra
[
0
]
*
cBGR0
+
bgra
[
1
]
*
cG
+
bgra
[
2
]
*
cBGR
2
,
SCALE
);
gray
[
i
]
=
(
uchar
)
t
;
}
rgb
a
+=
rgba_step
-
size
.
width
*
4
;
bgr
a
+=
rgba_step
-
size
.
width
*
4
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录