Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET
Hi,
Need a help regarding how to bend/curve image in .net.It should look like open in a book.Does any body knows mathematical formula to do this.It should not be cropped should shrink or adjust its color also.
I have example for other transformation like wave,twist but not able to produce curved image at right or left side (at a time only one side).
 
Thanks
 
----------------------------------------------------------------------
Thanks for your help,
I need this in winforms (if possible wpf is also fine). Actually in application there is concept of book and there can be any image on both pages.Hence I needed this.I hope this will clarify my question more.
 
Thanks
Posted 26-Nov-12 1:59am
Edited 26-Nov-12 7:34am
v2
Comments
aspnet_regiis -i at 26-Nov-12 9:32am
   
Wonderful question. But I cant answer it unless you tell me if you are coding for winforms or webforms...
Sergey Alexandrovich Kryukov at 26-Nov-12 11:28am
   
Right. Also, it's not just "formula" -- please see my comment below.
--SA
amitnaik at 26-Nov-12 13:36pm
   
its needed in winforms.I have improved my question.
Sergey Alexandrovich Kryukov at 26-Nov-12 11:24am
   
How is it related to "curved" transform? Please read the question.
--SA
Sergey Alexandrovich Kryukov at 26-Nov-12 21:56pm
   
(Sigh....)
Sergey Alexandrovich Kryukov at 26-Nov-12 11:27am
   
Interesting question. I voted 4, because it needs some more information; it should better tag the library you would like to use (see the comment by aspnet_regiis). Also, "mathematical formula" is not a problem at all, the problem is how would you apply it. Most likely, you need it parametric, changing in animated motion, and it also requires sufficient performance...
--SA
amitnaik at 27-Nov-12 15:03pm
   
Hi sergey.Thanks for your support,busy with my stuff.Yes i do need a parametric equation in terms of x and y (right now not thinking about animation stuff). I am thinking about curve line(y=ax^3+bx^2+cx+d) but getting somehow stiff slope, need smooth curve and what do u think about elliptical equation?
Sergey Alexandrovich Kryukov at 27-Nov-12 17:44pm
   
I see now. Well, this is something much easier. What physical behavior should it model. Really, an open book?
--SA
amitnaik at 27-Nov-12 15:22pm
   
I think parabolic formula in Cartesian format will do the job.but dont know how it will handle all x axis all +ve points.can't find proper coefficients.plz help, if u know.
Sergey Alexandrovich Kryukov at 27-Nov-12 17:50pm
   
I thinks it's much closer to logarithmic spiral. Please see my answer.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I think the open book roughly looks like a fragment of a logarithmic spiral: http://en.wikipedia.org/wiki/Logarithmic_spiral[^].
 
Open a book and you will see it; the center of the spiral will be near the point where the pages are attached. And it's very simply described parametrically, especially in polar coordinates.
 
Good luck,
—SA
  Permalink  
Comments
amitnaik at 30-Nov-12 0:56am
   
Hi SA.thanx for your help.I managed to find solution to get curve image after spending hours in different geometrical equations.
But i didn't got idea of how to use spiral equation to map source image pixel to target image(curved) pixel.
Soon will post solution and if possible article too.I will definitely look into WPF book control also.Thanks for help.
Sergey Alexandrovich Kryukov at 30-Nov-12 1:29am
   
Actual shape is more complex, but is the pages are not too long, it looks like the spiral. After all, open a book and see... still cannot see it?
--SA
amitnaik at 30-Nov-12 3:40am
   
Got your point SA. I will definitely try to implement if i come across such requirement for this in future.
Sergey Alexandrovich Kryukov at 30-Nov-12 13:59pm
   
Great. Will you formally accept the answer then (green button)? -- thanks.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

hi,
for solving this i tried many geometrical equation but was not able to relate with image pixel position.So what i did is, start at particular angle say 30 deg for left most pixel and then using Tan formula (trignometry) to get elevated 'y' pixel then just started dropping initial angle till right most pixel.repeat this for each line of image.
This way i got my required curve image.
Though as per sergey (SA's) solution , we can also use spiral equation with proper inputs not implemented yet.
Thanks all guys who posted their comments.
  Permalink  
Comments
Member 9496441 at 18-Feb-13 5:54am
   
Hi,
I am searching for the same solution. I need a curved image (eg. a Image printed on pen), how can I achieve this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 330
1 Sergey Alexandrovich Kryukov 295
2 Gihan Liyanage 222
3 Abhinav S 172
4 ClimerChinna 167
0 Sergey Alexandrovich Kryukov 8,188
1 OriginalGriff 6,991
2 CPallini 2,598
3 Richard MacCutchan 1,925
4 Abhinav S 1,736


Advertise | Privacy | Mobile
Web01 | 2.8.140826.1 | Last Updated 1 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100