I am working on something that requires the polar transformation of some images. I implemented this transformation with ImageTransformation
:
img = Import["https://i.sstatic.net/9cV4T.jpg"]
{center, radius} = ComponentMeasurements[MorphologicalComponents[img, 0.2],
{"Centroid", "EquivalentDiskRadius"}][[1, 2]];
polar = ImageTransformation[img, center + {Cos[#[[1]]], Sin[#[[1]]]}*#[[2]] &,
{2 Pi radius, radius}, DataRange -> Full,
PlotRange -> {{0, 360 \[Degree]}, {1, radius}}]
After some processing I would like to transform the image back into the original coordinate system. This step is where I ran into problems. The transformation of the coordinates isn't really the problem but I couldn't figure out how to center the transformation properly and what PlotRange
I have to provide.
So the question is how to reverse the transformation:
ImageTransformation[img, center + {Cos[#[[1]]], Sin[#[[1]]]}*#[[2]] &,
{2 Pi radius, radius}, DataRange -> Full,
PlotRange -> {{0, 360 \[Degree]}, {1, radius}}]
One of my failed attempts:
ImageTransformation[imgNorm, {0, Pi radius} + {Sqrt[#[[1]]^2 + #[[2]]^2],
ArcTan[#[[2]]/#[[1]]]} &, {2 radius, 2 radius}, DataRange -> Full]