Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
cb7cc816
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,发现更多精彩内容 >>
提交
cb7cc816
编写于
1月 29, 2016
作者:
V
Vladislav Sovrasov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add dft python test, fix platform depended result in morphology test
上级
aaa43dc8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
55 addition
and
17 deletion
+55
-17
modules/python/test/test.py
modules/python/test/test.py
+6
-13
modules/python/test/test_calibration.py
modules/python/test/test_calibration.py
+0
-1
modules/python/test/test_dft.py
modules/python/test/test_dft.py
+46
-0
modules/python/test/test_morphology.py
modules/python/test/test_morphology.py
+3
-3
未找到文件。
modules/python/test/test.py
浏览文件 @
cb7cc816
...
...
@@ -17,19 +17,6 @@ import numpy as np
import
cv2
import
argparse
# local test modules
from
test_digits
import
digits_test
from
test_calibration
import
calibration_test
from
test_squares
import
squares_test
from
test_texture_flow
import
texture_flow_test
from
test_fitline
import
fitline_test
from
test_houghcircles
import
houghcircles_test
from
test_houghlines
import
houghlines_test
from
test_gaussian_mix
import
gaussian_mix_test
from
test_facedetect
import
facedetect_test
from
test_kmeans
import
kmeans_test
from
test_morphology
import
morphology_test
# Python 3 moved urlopen to urllib.requests
try
:
from
urllib.request
import
urlopen
...
...
@@ -40,6 +27,12 @@ from tests_common import NewOpenCVTests
# Tests to run first; check the handful of basic operations that the later tests rely on
basedir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
def
load_tests
(
loader
,
tests
,
pattern
):
tests
.
addTests
(
loader
.
discover
(
basedir
,
pattern
=
'test_*.py'
))
return
tests
class
Hackathon244Tests
(
NewOpenCVTests
):
def
test_int_array
(
self
):
...
...
modules/python/test/test_calibration.py
浏览文件 @
cb7cc816
...
...
@@ -11,7 +11,6 @@ from __future__ import print_function
import
numpy
as
np
import
cv2
from
tests_common
import
NewOpenCVTests
class
calibration_test
(
NewOpenCVTests
):
...
...
modules/python/test/test_dft.py
0 → 100644
浏览文件 @
cb7cc816
#!/usr/bin/env python
'''
Test for disctrete fourier transform (dft)
'''
# Python 2/3 compatibility
from
__future__
import
print_function
import
cv2
import
numpy
as
np
import
sys
from
tests_common
import
NewOpenCVTests
class
dft_test
(
NewOpenCVTests
):
def
test_dft
(
self
):
img
=
self
.
get_sample
(
'samples/data/rubberwhale1.png'
,
0
)
eps
=
0.001
#test direct transform
refDft
=
np
.
fft
.
fft2
(
img
)
refDftShift
=
np
.
fft
.
fftshift
(
refDft
)
refMagnitide
=
np
.
log
(
1.0
+
np
.
abs
(
refDftShift
))
testDft
=
cv2
.
dft
(
np
.
float32
(
img
),
flags
=
cv2
.
DFT_COMPLEX_OUTPUT
)
testDftShift
=
np
.
fft
.
fftshift
(
testDft
)
testMagnitude
=
np
.
log
(
1.0
+
cv2
.
magnitude
(
testDftShift
[:,:,
0
],
testDftShift
[:,:,
1
]))
refMagnitide
=
cv2
.
normalize
(
refMagnitide
,
0.0
,
1.0
,
cv2
.
NORM_MINMAX
)
testMagnitude
=
cv2
.
normalize
(
testMagnitude
,
0.0
,
1.0
,
cv2
.
NORM_MINMAX
)
self
.
assertLess
(
cv2
.
norm
(
refMagnitide
-
testMagnitude
),
eps
)
#test inverse transform
img_back
=
np
.
fft
.
ifft2
(
refDft
)
img_back
=
np
.
abs
(
img_back
)
img_backTest
=
cv2
.
idft
(
testDft
)
img_backTest
=
cv2
.
magnitude
(
img_backTest
[:,:,
0
],
img_backTest
[:,:,
1
])
img_backTest
=
cv2
.
normalize
(
img_backTest
,
0.0
,
1.0
,
cv2
.
NORM_MINMAX
)
img_back
=
cv2
.
normalize
(
img_back
,
0.0
,
1.0
,
cv2
.
NORM_MINMAX
)
self
.
assertLess
(
cv2
.
norm
(
img_back
-
img_backTest
),
eps
)
\ No newline at end of file
modules/python/test/test_morphology.py
浏览文件 @
cb7cc816
...
...
@@ -18,14 +18,14 @@ class morphology_test(NewOpenCVTests):
def
test_morphology
(
self
):
fn
=
'samples/data/
baboon.jp
g'
fn
=
'samples/data/
rubberwhale1.pn
g'
img
=
self
.
get_sample
(
fn
)
modes
=
[
'erode/dilate'
,
'open/close'
,
'blackhat/tophat'
,
'gradient'
]
str_modes
=
[
'ellipse'
,
'rect'
,
'cross'
]
referenceHashes
=
{
modes
[
0
]:
'
1bd14fc814e41b80ce7816bc04f60b65'
,
modes
[
1
]
:
'1bd14fc814e41b80ce7816bc04f60b65
'
,
modes
[
2
]
:
'
cb18a5d28e77522dfec6a6255bc3847e'
,
modes
[
3
]
:
'84909517e4866aa079f4b2e2906bf47b
'
}
referenceHashes
=
{
modes
[
0
]:
'
071a526425b79e45b4d0d71ef51b0562'
,
modes
[
1
]
:
'071a526425b79e45b4d0d71ef51b0562
'
,
modes
[
2
]
:
'
427e89f581b7df1b60a831b1ed4c8618'
,
modes
[
3
]
:
'0dd8ad251088a63d0dd022bcdc57361c
'
}
def
update
(
cur_mode
):
cur_str_mode
=
str_modes
[
0
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录