Commit 312db1af authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Add test_polar_transform

parent 4ee6a55b
......@@ -11,9 +11,10 @@ from os.path import dirname, join
import numpy as np
import sympy
import pystencils
from pystencils_reco.resampling import downsample, scale_transform, translate, upsample
from pystencils_reco.resampling import downsample, resample, scale_transform, translate
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]')
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 =, as_gray=True).astype(np.float32)
transformed = np.zeros((500, 500), np.float32)
resample(x, y).compile()(x=lenna, y=transformed)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment