Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stephan Seitz
pystencil_reco
Commits
312db1af
Commit
312db1af
authored
Jan 07, 2020
by
Stephan Seitz
Browse files
Add test_polar_transform
parent
4ee6a55b
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_superresolution.py
View file @
312db1af
...
...
@@ -11,9 +11,10 @@ from os.path import dirname, join
import
numpy
as
np
import
skimage.io
import
sympy
import
pystencils
from
pystencils_reco.resampling
import
downsample
,
scale_transform
,
translate
,
upsample
from
pystencils_reco.resampling
import
downsample
,
resample
,
scale_transform
,
translate
try
:
import
pyconrad.autoinit
...
...
@@ -62,3 +63,20 @@ def test_warp():
for
i
in
range
(
len
(
warped
)):
warp_kernel
(
lenna
[
i
],
warped
[
i
],
warp_vectors
[
i
])
def
test_polar_transform
():
x
,
y
=
pystencils
.
fields
(
'x, y: float32[2d]'
)
x
.
set_coordinate_origin_to_field_center
()
y
.
set_coordinate_origin_to_field_center
()
y
.
coordinate_transform
=
lambda
x
:
sympy
.
Matrix
((
x
.
norm
(),
sympy
.
atan2
(
*
x
)
/
(
2
*
sympy
.
pi
)
*
y
.
shape
[
1
]))
lenna_file
=
join
(
dirname
(
__file__
),
"test_data"
,
"lenna.png"
)
lenna
=
skimage
.
io
.
imread
(
lenna_file
,
as_gray
=
True
).
astype
(
np
.
float32
)
transformed
=
np
.
zeros
((
500
,
500
),
np
.
float32
)
resample
(
x
,
y
).
compile
()(
x
=
lenna
,
y
=
transformed
)
pyconrad
.
imshow
(
transformed
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment