Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
4a63b3dd
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,体验更适合开发者的 AI 搜索 >>
提交
4a63b3dd
编写于
4月 09, 2014
作者:
I
Ilya Lavrenov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cv2cvtest part2
上级
5600bc54
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
49 addition
and
39 deletion
+49
-39
modules/highgui/test/test_ffmpeg.cpp
modules/highgui/test/test_ffmpeg.cpp
+1
-1
modules/highgui/test/test_video_io.cpp
modules/highgui/test/test_video_io.cpp
+6
-6
modules/highgui/test/test_video_pos.cpp
modules/highgui/test/test_video_pos.cpp
+1
-1
modules/legacy/test/test_stereomatching.cpp
modules/legacy/test/test_stereomatching.cpp
+1
-1
modules/optim/test/test_denoise_tvl1.cpp
modules/optim/test/test_denoise_tvl1.cpp
+19
-16
modules/photo/test/test_denoising.cpp
modules/photo/test/test_denoising.cpp
+4
-4
modules/photo/test/test_inpaint.cpp
modules/photo/test/test_inpaint.cpp
+4
-4
modules/stitching/test/test_blenders.cpp
modules/stitching/test/test_blenders.cpp
+1
-1
modules/ts/include/opencv2/ts.hpp
modules/ts/include/opencv2/ts.hpp
+1
-0
modules/ts/src/ts_func.cpp
modules/ts/src/ts_func.cpp
+6
-0
modules/video/test/test_estimaterigid.cpp
modules/video/test/test_estimaterigid.cpp
+5
-5
未找到文件。
modules/highgui/test/test_ffmpeg.cpp
浏览文件 @
4a63b3dd
...
...
@@ -329,7 +329,7 @@ public:
EXPECT_EQ
(
reference
.
depth
(),
actual
.
depth
());
EXPECT_EQ
(
reference
.
channels
(),
actual
.
channels
());
double
psnr
=
PSNR
(
actual
,
reference
);
double
psnr
=
cvtest
::
PSNR
(
actual
,
reference
);
if
(
psnr
<
eps
)
{
#define SUM cvtest::TS::SUMMARY
...
...
modules/highgui/test/test_video_io.cpp
浏览文件 @
4a63b3dd
...
...
@@ -198,7 +198,7 @@ void CV_HighGuiTest::ImageTest(const string& dir)
}
const
double
thresDbell
=
20
;
double
psnr
=
PSNR
(
loaded
,
image
);
double
psnr
=
cvtest
::
PSNR
(
loaded
,
image
);
if
(
psnr
<
thresDbell
)
{
ts
->
printf
(
ts
->
LOG
,
"Reading image from file: too big difference (=%g) with fmt=%s
\n
"
,
psnr
,
ext
.
c_str
());
...
...
@@ -235,7 +235,7 @@ void CV_HighGuiTest::ImageTest(const string& dir)
continue
;
}
psnr
=
PSNR
(
buf_loaded
,
image
);
psnr
=
cvtest
::
PSNR
(
buf_loaded
,
image
);
if
(
psnr
<
thresDbell
)
{
...
...
@@ -316,7 +316,7 @@ void CV_HighGuiTest::VideoTest(const string& dir, const cvtest::VideoFormat& fmt
Mat
img
=
frames
[
i
];
Mat
img1
=
cv
::
cvarrToMat
(
ipl1
);
double
psnr
=
PSNR
(
img1
,
img
);
double
psnr
=
cvtest
::
PSNR
(
img1
,
img
);
if
(
psnr
<
thresDbell
)
{
ts
->
printf
(
ts
->
LOG
,
"Too low frame %d psnr = %gdb
\n
"
,
i
,
psnr
);
...
...
@@ -371,7 +371,7 @@ void CV_HighGuiTest::SpecificImageTest(const string& dir)
}
const
double
thresDbell
=
20
;
double
psnr
=
PSNR
(
loaded
,
image
);
double
psnr
=
cvtest
::
PSNR
(
loaded
,
image
);
if
(
psnr
<
thresDbell
)
{
ts
->
printf
(
ts
->
LOG
,
"Reading image from file: too big difference (=%g) with fmt=bmp
\n
"
,
psnr
);
...
...
@@ -408,7 +408,7 @@ void CV_HighGuiTest::SpecificImageTest(const string& dir)
continue
;
}
psnr
=
PSNR
(
buf_loaded
,
image
);
psnr
=
cvtest
::
PSNR
(
buf_loaded
,
image
);
if
(
psnr
<
thresDbell
)
{
...
...
@@ -521,7 +521,7 @@ void CV_HighGuiTest::SpecificVideoTest(const string& dir, const cvtest::VideoFor
Mat
img
=
images
[
i
];
const
double
thresDbell
=
40
;
double
psnr
=
PSNR
(
img
,
frame
);
double
psnr
=
cvtest
::
PSNR
(
img
,
frame
);
if
(
psnr
>
thresDbell
)
{
...
...
modules/highgui/test/test_video_pos.cpp
浏览文件 @
4a63b3dd
...
...
@@ -160,7 +160,7 @@ public:
return
;
}
double
err
=
PSNR
(
img
,
img0
);
double
err
=
cvtest
::
PSNR
(
img
,
img0
);
if
(
err
<
20
)
{
...
...
modules/legacy/test/test_stereomatching.cpp
浏览文件 @
4a63b3dd
...
...
@@ -278,7 +278,7 @@ float dispRMS( const Mat& computedDisp, const Mat& groundTruthDisp, const Mat& m
checkTypeAndSizeOfMask
(
mask
,
sz
);
pointsCount
=
countNonZero
(
mask
);
}
return
1.
f
/
sqrt
((
float
)
pointsCount
)
*
(
float
)
norm
(
computedDisp
,
groundTruthDisp
,
NORM_L2
,
mask
);
return
1.
f
/
sqrt
((
float
)
pointsCount
)
*
(
float
)
cvtest
::
norm
(
computedDisp
,
groundTruthDisp
,
NORM_L2
,
mask
);
}
/*
...
...
modules/optim/test/test_denoise_tvl1.cpp
浏览文件 @
4a63b3dd
...
...
@@ -41,7 +41,8 @@
#include "test_precomp.hpp"
#include "opencv2/highgui.hpp"
void
make_noisy
(
const
cv
::
Mat
&
img
,
cv
::
Mat
&
noisy
,
double
sigma
,
double
pepper_salt_ratio
,
cv
::
RNG
&
rng
){
void
make_noisy
(
const
cv
::
Mat
&
img
,
cv
::
Mat
&
noisy
,
double
sigma
,
double
pepper_salt_ratio
,
cv
::
RNG
&
rng
)
{
noisy
.
create
(
img
.
size
(),
img
.
type
());
cv
::
Mat
noise
(
img
.
size
(),
img
.
type
()),
mask
(
img
.
size
(),
CV_8U
);
rng
.
fill
(
noise
,
cv
::
RNG
::
NORMAL
,
128.0
,
sigma
);
...
...
@@ -54,34 +55,36 @@ void make_noisy(const cv::Mat& img, cv::Mat& noisy, double sigma, double pepper_
noise
.
setTo
(
128
,
mask
);
cv
::
addWeighted
(
noisy
,
1
,
noise
,
1
,
-
128
,
noisy
);
}
void
make_spotty
(
cv
::
Mat
&
img
,
cv
::
RNG
&
rng
,
int
r
=
3
,
int
n
=
1000
){
for
(
int
i
=
0
;
i
<
n
;
i
++
){
void
make_spotty
(
cv
::
Mat
&
img
,
cv
::
RNG
&
rng
,
int
r
=
3
,
int
n
=
1000
)
{
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
int
x
=
rng
(
img
.
cols
-
r
),
y
=
rng
(
img
.
rows
-
r
);
if
(
rng
(
2
)
==
0
)
{
if
(
rng
(
2
)
==
0
)
img
(
cv
::
Range
(
y
,
y
+
r
),
cv
::
Range
(
x
,
x
+
r
))
=
(
uchar
)
0
;
}
else
{
else
img
(
cv
::
Range
(
y
,
y
+
r
),
cv
::
Range
(
x
,
x
+
r
))
=
(
uchar
)
255
;
}
}
}
bool
validate_pixel
(
const
cv
::
Mat
&
image
,
int
x
,
int
y
,
uchar
val
){
bool
validate_pixel
(
const
cv
::
Mat
&
image
,
int
x
,
int
y
,
uchar
val
)
{
printf
(
"test: image(%d,%d)=%d vs %d - %s
\n
"
,
x
,
y
,(
int
)
image
.
at
<
uchar
>
(
x
,
y
),
val
,(
val
==
image
.
at
<
uchar
>
(
x
,
y
))
?
"true"
:
"false"
);
return
(
image
.
at
<
uchar
>
(
x
,
y
)
==
val
);
}
TEST
(
Optim_denoise_tvl1
,
regression_basic
){
TEST
(
Optim_denoise_tvl1
,
regression_basic
)
{
cv
::
RNG
rng
(
42
);
cv
::
Mat
img
=
cv
::
imread
(
"lena.jpg"
,
0
),
noisy
,
res
;
if
(
img
.
rows
!=
512
||
img
.
cols
!=
512
){
printf
(
"
\t
please, put lena.jpg from samples/c in the current folder
\n
"
);
printf
(
"
\t
now, the test will fail...
\n
"
);
ASSERT_TRUE
(
false
);
}
cv
::
Mat
img
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"shared/lena.png"
,
0
),
noisy
,
res
;
ASSERT_FALSE
(
img
.
empty
())
<<
"Error: can't open 'lena.png'"
;
const
int
obs_num
=
5
;
std
::
vector
<
cv
::
Mat
>
images
(
obs_num
,
cv
::
Mat
());
for
(
int
i
=
0
;
i
<
(
int
)
images
.
size
();
i
++
){
std
::
vector
<
cv
::
Mat
>
images
(
obs_num
,
cv
::
Mat
());
for
(
int
i
=
0
;
i
<
(
int
)
images
.
size
();
i
++
)
{
make_noisy
(
img
,
images
[
i
],
20
,
0.02
,
rng
);
//make_spotty(images[i],rng);
}
...
...
modules/photo/test/test_denoising.cpp
浏览文件 @
4a63b3dd
...
...
@@ -73,7 +73,7 @@ TEST(Photo_DenoisingGrayscale, regression)
DUMP
(
result
,
expected_path
+
".res.png"
);
ASSERT_EQ
(
0
,
norm
(
result
!=
expected
));
ASSERT_EQ
(
0
,
cvtest
::
norm
(
result
,
expected
,
NORM_L2
));
}
TEST
(
Photo_DenoisingColored
,
regression
)
...
...
@@ -93,7 +93,7 @@ TEST(Photo_DenoisingColored, regression)
DUMP
(
result
,
expected_path
+
".res.png"
);
ASSERT_EQ
(
0
,
norm
(
result
!=
expected
));
ASSERT_EQ
(
0
,
cvtest
::
norm
(
result
,
expected
,
NORM_L2
));
}
TEST
(
Photo_DenoisingGrayscaleMulti
,
regression
)
...
...
@@ -118,7 +118,7 @@ TEST(Photo_DenoisingGrayscaleMulti, regression)
DUMP
(
result
,
expected_path
+
".res.png"
);
ASSERT_EQ
(
0
,
norm
(
result
!=
expected
));
ASSERT_EQ
(
0
,
cvtest
::
norm
(
result
,
expected
,
NORM_L2
));
}
TEST
(
Photo_DenoisingColoredMulti
,
regression
)
...
...
@@ -143,7 +143,7 @@ TEST(Photo_DenoisingColoredMulti, regression)
DUMP
(
result
,
expected_path
+
".res.png"
);
ASSERT_EQ
(
0
,
norm
(
result
!=
expected
));
ASSERT_EQ
(
0
,
cvtest
::
norm
(
result
,
expected
,
NORM_L2
));
}
TEST
(
Photo_White
,
issue_2646
)
...
...
modules/photo/test/test_inpaint.cpp
浏览文件 @
4a63b3dd
...
...
@@ -91,8 +91,8 @@ void CV_InpaintTest::run( int )
absdiff
(
orig
,
res1
,
diff1
);
absdiff
(
orig
,
res2
,
diff2
);
double
n1
=
norm
(
diff1
.
reshape
(
1
),
NORM_INF
,
inv_mask
.
reshape
(
1
));
double
n2
=
norm
(
diff2
.
reshape
(
1
),
NORM_INF
,
inv_mask
.
reshape
(
1
));
double
n1
=
cvtest
::
norm
(
diff1
.
reshape
(
1
),
NORM_INF
,
inv_mask
.
reshape
(
1
));
double
n2
=
cvtest
::
norm
(
diff2
.
reshape
(
1
),
NORM_INF
,
inv_mask
.
reshape
(
1
));
if
(
n1
!=
0
||
n2
!=
0
)
{
...
...
@@ -103,8 +103,8 @@ void CV_InpaintTest::run( int )
absdiff
(
exp1
,
res1
,
diff1
);
absdiff
(
exp2
,
res2
,
diff2
);
n1
=
norm
(
diff1
.
reshape
(
1
),
NORM_INF
,
mask
.
reshape
(
1
));
n2
=
norm
(
diff2
.
reshape
(
1
),
NORM_INF
,
mask
.
reshape
(
1
));
n1
=
cvtest
::
norm
(
diff1
.
reshape
(
1
),
NORM_INF
,
mask
.
reshape
(
1
));
n2
=
cvtest
::
norm
(
diff2
.
reshape
(
1
),
NORM_INF
,
mask
.
reshape
(
1
));
const
int
jpeg_thres
=
3
;
if
(
n1
>
jpeg_thres
||
n2
>
jpeg_thres
)
...
...
modules/stitching/test/test_blenders.cpp
浏览文件 @
4a63b3dd
...
...
@@ -73,6 +73,6 @@ TEST(MultiBandBlender, CanBlendTwoImages)
Mat
result
;
result_s
.
convertTo
(
result
,
CV_8U
);
Mat
expected
=
imread
(
string
(
cvtest
::
TS
::
ptr
()
->
get_data_path
())
+
"stitching/baboon_lena.png"
);
double
rmsErr
=
norm
(
expected
,
result
,
NORM_L2
)
/
sqrt
(
double
(
expected
.
size
().
area
()));
double
rmsErr
=
cvtest
::
norm
(
expected
,
result
,
NORM_L2
)
/
sqrt
(
double
(
expected
.
size
().
area
()));
ASSERT_LT
(
rmsErr
,
1e-3
);
}
modules/ts/include/opencv2/ts.hpp
浏览文件 @
4a63b3dd
...
...
@@ -129,6 +129,7 @@ CV_EXPORTS void minMaxLoc(const Mat& src, double* minval, double* maxval,
CV_EXPORTS
double
norm
(
InputArray
src
,
int
normType
,
InputArray
mask
=
noArray
());
CV_EXPORTS
double
norm
(
InputArray
src1
,
InputArray
src2
,
int
normType
,
InputArray
mask
=
noArray
());
CV_EXPORTS
Scalar
mean
(
const
Mat
&
src
,
const
Mat
&
mask
=
Mat
());
CV_EXPORTS
double
PSNR
(
InputArray
src1
,
InputArray
src2
);
CV_EXPORTS
bool
cmpUlps
(
const
Mat
&
data
,
const
Mat
&
refdata
,
int
expMaxDiff
,
double
*
realMaxDiff
,
vector
<
int
>*
idx
);
...
...
modules/ts/src/ts_func.cpp
浏览文件 @
4a63b3dd
...
...
@@ -1399,6 +1399,12 @@ double norm(InputArray _src1, InputArray _src2, int normType, InputArray _mask)
return
isRelative
?
result
/
(
cvtest
::
norm
(
src2
,
normType
)
+
DBL_EPSILON
)
:
result
;
}
double
PSNR
(
InputArray
_src1
,
InputArray
_src2
)
{
CV_Assert
(
_src1
.
depth
()
==
CV_8U
);
double
diff
=
std
::
sqrt
(
cvtest
::
norm
(
_src1
,
_src2
,
NORM_L2SQR
)
/
(
_src1
.
total
()
*
_src1
.
channels
()));
return
20
*
log10
(
255.
/
(
diff
+
DBL_EPSILON
));
}
template
<
typename
_Tp
>
static
double
crossCorr_
(
const
_Tp
*
src1
,
const
_Tp
*
src2
,
size_t
total
)
...
...
modules/video/test/test_estimaterigid.cpp
浏览文件 @
4a63b3dd
...
...
@@ -109,8 +109,8 @@ bool CV_RigidTransform_Test::testNPoints(int from)
Mat
aff_est
=
estimateRigidTransform
(
fpts
,
tpts
,
true
);
double
thres
=
0.1
*
norm
(
aff
);
double
d
=
norm
(
aff_est
,
aff
,
NORM_L2
);
double
thres
=
0.1
*
cvtest
::
norm
(
aff
,
NORM_L2
);
double
d
=
cvtest
::
norm
(
aff_est
,
aff
,
NORM_L2
);
if
(
d
>
thres
)
{
double
dB
=
0
,
nB
=
0
;
...
...
@@ -120,7 +120,7 @@ bool CV_RigidTransform_Test::testNPoints(int from)
Mat
B
=
A
-
repeat
(
A
.
row
(
0
),
3
,
1
),
Bt
=
B
.
t
();
B
=
Bt
*
B
;
dB
=
cv
::
determinant
(
B
);
nB
=
norm
(
B
);
nB
=
cvtest
::
norm
(
B
,
NORM_L2
);
if
(
fabs
(
dB
)
<
0.01
*
nB
)
continue
;
}
...
...
@@ -154,11 +154,11 @@ bool CV_RigidTransform_Test::testImage()
Mat
aff_est
=
estimateRigidTransform
(
img
,
rotated
,
true
);
const
double
thres
=
0.033
;
if
(
norm
(
aff_est
,
aff
,
NORM_INF
)
>
thres
)
if
(
cvtest
::
norm
(
aff_est
,
aff
,
NORM_INF
)
>
thres
)
{
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_BAD_ACCURACY
);
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"Threshold = %f, norm of difference = %f"
,
thres
,
norm
(
aff_est
,
aff
,
NORM_INF
)
);
cvtest
::
norm
(
aff_est
,
aff
,
NORM_INF
)
);
return
false
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录