<p>A quickly formulated method, read first one that popped in my brain (not best), could be. Find the closest points on a parametric spiral for each sample (read <a href="http://alvyray.com/Memos/CG/Microsoft/6_pixel.pdf" rel="nofollow noreferrer">A Pixel Is Not A Little Square<sup>3</sup></a>). Then place the samples on a line by placing the pints in one axis by how far they are from your spiral line and the other by what the closest point is.</p>

<p><img src="https://i.sstatic.net/m8TYh.png" alt="spiral[1"></p>

<p>You can then use something like poisson disk sampling to reconstruct the image (maybe the didsk should be longer ovals the further away they are form the center line and less long as you progress further into the spiral).</p>

<p>Now that I think of the problem a bit more. A simpler approach could be to map the image on mesh, using UV mapping, then unwrap the mesh. A triangular mesh might exhibit some artifacts so using a B-spline interpolation could be better. Several image mesh algorithms exist and you even have these in Photoshop.</p>

<p><img src="https://i.sstatic.net/Qc5qt.png" alt="unwound spiral"></p>

<p><strong>Image 2</strong>: A proof of concept of unwound spiral with the mesh method. Note i scaled the unwound spirals length to make it fit the site requirements better.</p>

<p>From initial test in my 3D app of choice seems that a dense enough triangular mesh works fine.</p>

CC BY-SA 3.0
2016-05-19T09:18:53.697Z
Thanks for this Joojaa.  It does sound like do my work for me doesn't it? But it was genuinely just as idle thought on the train.  You'll given me some cool clues to get started with (I've never fiddled with image manipulation like this before (which is why it sounds a bit 'DMWFM' - I didn't have a starting point.  Now, thanks to you, I do)).  I'll probably fiddle with this in idle moment - and I may be back with further questions (and my own source code!) later.  Thanks again!
headbanger
CC BY-SA 3.0
2016-05-12T07:43:31.303Z
2016-05-12T14:40:56.900Z
2016-05-12T14:40:56.900Z
joojaa
<p>Here's an odd intellectual puzzle.  Something I was daydreaming about on a train - but the maths are somewhat beyond me.  How would someone go about un-winding a spiral to produce a long flat image?  Like a rope on a spool, I'd want to uncoil the rope so that it lay long and flat.  The function would have to take in the image data (imageData) and the imageHeight (the height of the output strip - and hence also the thickness of the 'rope' on the spool).  Assumptions that could be made are that the input image is square, containing a circle whose top and bottom touch the top and bottom of the square - and left and right similarly.  The hub of circle would be in the absolute centre of the image.</p>

<pre><code>(char*) unwindImage (char* imageData, int imageHeight)
</code></pre>

<p>Has anyone else puzzled over this?  And, if so, what solution did your come up with?</p>

CC BY-SA 3.0
2016-05-10T17:08:59.257Z
Hi headbanger, image warping transformations are certainly possible but it's a bit unclear from your question what you're looking for. An example before/after screenshot or diagram would help.
Nathan Reed
CC BY-SA 3.0
2016-05-12T08:38:12.673Z
I think the question is pretty clear in intention. Just dont expect people to publish code for you as the question sounds more like do my work for me the way its presented.
joojaa
CC BY-SA 4.0
2020-04-28T15:17:20.030Z
https://commons.wikimedia.org/wiki/File:Unrolled_cardioid.svg
Adam
<algorithm><transformations><mathematics><image-processing>
Unwinding an image on a spiral to make it long and flat
headbanger
# Unwinding an image on a spiral to make it long and flat

(Asked by: username_0 on 2016-05-09)

Here's an odd intellectual puzzle. Something I was daydreaming about on a train - but the maths are somewhat beyond me. How would someone go about un-winding a spiral to produce a long flat image? Like a rope on a spool, I'd want to uncoil the rope so that it lay long and flat. The function would have to take in the image data (imageData) and the imageHeight (the height of the output strip - and hence also the thickness of the 'rope' on the spool). Assumptions that could be made are that the input image is square, containing a circle whose top and bottom touch the top and bottom of the square - and left and right similarly. The hub of circle would be in the absolute centre of the image.

```
(char*) unwindImage (char* imageData, int imageHeight)

```

Has anyone else puzzled over this? And, if so, what solution did your come up with?

**Tags:** algorithm, transformations, mathematics, image-processing

> **Comments:**
> **username_1**: Hi username_0, image warping transformations are certainly possible but it's a bit unclear from your question what you're looking for. An example before/after screenshot or diagram would help.  
> **username_2**: I think the question is pretty clear in intention. Just dont expect people to publish code for you as the question sounds more like do my work for me the way its presented.  
> **username_3**: https://commons.wikimedia.org/wiki/File:Unrolled_cardioid.svg  

---

## 1 answers

### Answer by username_2 on 2016-05-12. Score: 5

A quickly formulated method, read first one that popped in my brain (not best), could be. Find the closest points on a parametric spiral for each sample (read [A Pixel Is Not A Little Square3](http://alvyray.com/Memos/CG/Microsoft/6_pixel.pdf)). Then place the samples on a line by placing the pints in one axis by how far they are from your spiral line and the other by what the closest point is.

![spiral[1](https://i.sstatic.net/m8TYh.png)

You can then use something like poisson disk sampling to reconstruct the image (maybe the didsk should be longer ovals the further away they are form the center line and less long as you progress further into the spiral).

Now that I think of the problem a bit more. A simpler approach could be to map the image on mesh, using UV mapping, then unwrap the mesh. A triangular mesh might exhibit some artifacts so using a B-spline interpolation could be better. Several image mesh algorithms exist and you even have these in Photoshop.

![unwound spiral](https://i.sstatic.net/Qc5qt.png)

**Image 2**: A proof of concept of unwound spiral with the mesh method. Note i scaled the unwound spirals length to make it fit the site requirements better.

From initial test in my 3D app of choice seems that a dense enough triangular mesh works fine.

> **Comments:**
> **username_0**: Thanks for this username_2.  It does sound like do my work for me doesn't it? But it was genuinely just as idle thought on the train.  You'll given me some cool clues to get started with (I've never fiddled with image manipulation like this before (which is why it sounds a bit 'DMWFM' - I didn't have a starting point.  Now, thanks to you, I do)).  I'll probably fiddle with this in idle moment - and I may be back with further questions (and my own source code!) later.  Thanks again!  

---

