How does the spiral transform works?
Well, to give a clearer explanation, spiralbw gives the value in 0,1,2,3,4,5,6 all around in a spiral fashion. That’s what I call the coordinate map.
Every value of coordinate uses the top left coordinate of pixel which means it starts with 0,0
0 | 1 | 2 | 3 |
---|---|---|---|
11 | 12 | 13 | 4 |
10 | 15 | 14 | 5 |
9 | 8 | 7 | 6 |
On the left side of i, that translate into
0 | 1 | 2 | 3 |
---|---|---|---|
3 | 0 | 1 | 0 |
2 | 3 | 2 | 1 |
1 | 0 | 3 | 2 |
On the right side, it translate to
0 | 0 | 0 | 0 |
---|---|---|---|
2 | 3 | 3 | 1 |
2 | 3 | 3 | 1 |
2 | 2 | 1 | 1 |
The left side is the x coordinate, and the right side is the y coordinate. Combining them gives this.
0,0 | 1,0 | 2,0 | 3,0 |
---|---|---|---|
3,2 | 0,3 | 1,3 | 0,1 |
2,2 | 3,3 | 2,3 | 1,1 |
1,2 | 0,2 | 3,1 | 2,1 |
That what represents the output. The output is given by these coordinates. Use your mouse to get to where’s the original coordinate. It goes from left to right, top to bottom order. I used c++ to get the reverse transform since I had no idea how to reverse it otherwise.
@David_Tschumperle Warp does seem to return the original image, however there’s some missing information after 2^24 pixel. At least it doesn’t have the issue of the original dynamic array code.
See a close-up here -