2
$\begingroup$

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?

$\endgroup$
  • 1
    $\begingroup$ 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. $\endgroup$ – Nathan Reed May 10 '16 at 17:08
  • $\begingroup$ 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. $\endgroup$ – joojaa May 12 '16 at 8:38
5
$\begingroup$

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). 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

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

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.

$\endgroup$
  • $\begingroup$ 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! $\endgroup$ – headbanger May 19 '16 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.