I’m trying to fix the reverse spiral transform but I don’t know what to do at all. I know that Reptorian’s already sorted out the spiral transform and I can condense it into this:
However, I really don’t know how this works. As far as I know, this reads like how I imagine the reverse spiral transform to be. Since the index values for where the pixels after the spiral transform should be after the reverse spiral transform are found in the values of the pixels in the spiral, it should be possible to map them back. I don’t know how to do this at all since everything I’ve tried just gives me the spiral transform. How can I swap the pixels in the spiral transform with other pixels so that I can get the original back without having to construct another map or through using dynamic arrays?
More generally, if there is an image specifying the order in which pixels go, how do I transform back to the original order? I can actually get part of the way there in the spiral case if I do this:
Edit: I’ve found a way to use the
warp command to sort this whole mess out. G’MIC never fails to surprise, and this command is certainly extremely helpful! This script will return the original image (which I’ve assumed is already in the pipeline) through a spiral transform and a reverse spiral transform.
# Here comes the magic!