Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
68bb317c
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,发现更多精彩内容 >>
提交
68bb317c
编写于
2月 28, 2013
作者:
A
Andrey Kamaev
提交者:
OpenCV Buildbot
2月 28, 2013
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #462 from kobigurk:master
上级
d620ef0d
18a5b8df
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
3 deletion
+26
-3
modules/highgui/src/grfmt_tiff.cpp
modules/highgui/src/grfmt_tiff.cpp
+20
-2
modules/highgui/src/grfmt_tiff.hpp
modules/highgui/src/grfmt_tiff.hpp
+1
-0
modules/highgui/test/test_grfmt.cpp
modules/highgui/test/test_grfmt.cpp
+5
-1
未找到文件。
modules/highgui/src/grfmt_tiff.cpp
浏览文件 @
68bb317c
...
...
@@ -101,6 +101,11 @@ bool TiffDecoder::checkSignature( const std::string& signature ) const
memcmp
(
signature
.
c_str
(),
fmtSignTiffMM
,
4
)
==
0
);
}
int
TiffDecoder
::
normalizeChannelsNumber
(
int
channels
)
const
{
return
channels
>
4
?
4
:
channels
;
}
ImageDecoder
TiffDecoder
::
newDecoder
()
const
{
return
new
TiffDecoder
;
...
...
@@ -133,10 +138,11 @@ bool TiffDecoder::readHeader()
(
ncn
!=
1
&&
ncn
!=
3
&&
ncn
!=
4
)))
bpp
=
8
;
int
wanted_channels
=
normalizeChannelsNumber
(
ncn
);
switch
(
bpp
)
{
case
8
:
m_type
=
CV_MAKETYPE
(
CV_8U
,
photometric
>
1
?
3
:
1
);
m_type
=
CV_MAKETYPE
(
CV_8U
,
photometric
>
1
?
wanted_channels
:
1
);
break
;
case
16
:
m_type
=
CV_MAKETYPE
(
CV_16U
,
photometric
>
1
?
3
:
1
);
...
...
@@ -185,6 +191,7 @@ bool TiffDecoder::readData( Mat& img )
TIFFGetField
(
tif
,
TIFFTAG_SAMPLESPERPIXEL
,
&
ncn
);
const
int
bitsPerByte
=
8
;
int
dst_bpp
=
(
int
)(
img
.
elemSize1
()
*
bitsPerByte
);
int
wanted_channels
=
normalizeChannelsNumber
(
img
.
channels
());
if
(
dst_bpp
==
8
)
{
...
...
@@ -248,9 +255,20 @@ bool TiffDecoder::readData( Mat& img )
for
(
i
=
0
;
i
<
tile_height
;
i
++
)
if
(
color
)
icvCvt_BGRA2BGR_8u_C4C3R
(
buffer
+
i
*
tile_width
*
4
,
0
,
{
if
(
wanted_channels
==
4
)
{
icvCvt_BGRA2RGBA_8u_C4R
(
buffer
+
i
*
tile_width
*
4
,
0
,
data
+
x
*
4
+
img
.
step
*
(
tile_height
-
i
-
1
),
0
,
cvSize
(
tile_width
,
1
)
);
}
else
{
icvCvt_BGRA2BGR_8u_C4C3R
(
buffer
+
i
*
tile_width
*
4
,
0
,
data
+
x
*
3
+
img
.
step
*
(
tile_height
-
i
-
1
),
0
,
cvSize
(
tile_width
,
1
),
2
);
}
}
else
icvCvt_BGRA2Gray_8u_C4C1R
(
buffer
+
i
*
tile_width
*
4
,
0
,
data
+
x
+
img
.
step
*
(
tile_height
-
i
-
1
),
0
,
...
...
modules/highgui/src/grfmt_tiff.hpp
浏览文件 @
68bb317c
...
...
@@ -107,6 +107,7 @@ public:
protected:
void
*
m_tif
;
int
normalizeChannelsNumber
(
int
channels
)
const
;
};
#endif
...
...
modules/highgui/test/test_grfmt.cpp
浏览文件 @
68bb317c
...
...
@@ -99,8 +99,11 @@ public:
{
if
(
ext_from_int
(
ext
).
empty
())
continue
;
for
(
int
num_channels
=
1
;
num_channels
<=
3
;
num_channels
+=
2
)
for
(
int
num_channels
=
1
;
num_channels
<=
4
;
num_channels
++
)
{
if
(
num_channels
==
2
)
continue
;
if
(
num_channels
==
4
&&
ext
!=
3
/*TIFF*/
)
continue
;
ts
->
printf
(
ts
->
LOG
,
"image type depth:%d channels:%d ext: %s
\n
"
,
CV_8U
,
num_channels
,
ext_from_int
(
ext
).
c_str
());
Mat
img
(
img_r
*
k
,
img_c
*
k
,
CV_MAKETYPE
(
CV_8U
,
num_channels
),
Scalar
::
all
(
0
));
circle
(
img
,
Point2i
((
img_c
*
k
)
/
2
,
(
img_r
*
k
)
/
2
),
std
::
min
((
img_r
*
k
),
(
img_c
*
k
))
/
4
,
Scalar
::
all
(
255
));
...
...
@@ -116,6 +119,7 @@ public:
CV_Assert
(
img
.
size
()
==
img_test
.
size
());
CV_Assert
(
img
.
type
()
==
img_test
.
type
());
CV_Assert
(
num_channels
==
img_test
.
channels
());
double
n
=
norm
(
img
,
img_test
);
if
(
n
>
1.0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录