4

I'm looking for a way of performing dewarping on an image of a curved bottle label, such that the curved text in the original image appears as a straight line in the altered image. The following is an example of an image I might be looking to dewarp:

enter image description here

I've been referencing a 2013 paper (Ye et al.) which seems to be doing some similar work, but I'm having a hard time figuring out where the authors are getting their variables from in the math they describe. I'm hoping someone here might be able to help me out.

The authors start by clearly labeling the variables they intend to use in a diagram:

enter image description here

And then itemizing the equations they use to perform the dewarping operation:

enter image description here

Their final result looks like this:

enter image description here

This seems straightforward enough; however, I don't see where they're getting many of the variables they list in the original diagram. From what I've read, the focal length (f) needs to be measured specifically for the camera you're using to capture the original image. However, there is no indication in the paper of how to calculate angle Q, the radius of the bottle, or any of the edge lengths from the captured image. I haven't been able to find anything online describing how to do this. Does anyone know of a method that might be used to calculate any one of these variables from the image given? I apologize for the vague details - I have very little information to go on here. Thank you in advance for any help you can give.

Edit: Suggestions on tags to include with the post are welcome - I'm not sure who might be able to help with this kind of question.

A.S.
  • 111
  • 2
  • 7
  • 1
    throwing those equations around is just silly. those equations are code. they explain the geometry to you. -- *but* you know it involves trigonometry... so you're prepared and don't expect a simple answer -- ok here's what I would do: (1) estimate the camera matrix (2) estimate the cylinder's pose relative to camera (3) generate 3d points on the cylinder's surface, which represent the pixels of that cylinder's texture (4) project those 3d points into the picture, sample the picture, assign texture element – Christoph Rackwitz Jun 13 '22 at 06:53
  • 1
    no, you can just guess the focal length (and ignore all distortion coefficients). if it's too far off, you'll see that in the results. make yourself a trivial gui with opencv, put a slider in there, for every parameter you aren't sure of. – Christoph Rackwitz Jun 13 '22 at 06:55
  • 1
    related: https://stackoverflow.com/questions/71869717/how-to-straighten-lines-in-a-cylinder-when-looked-at-from-a-sideways-perspective (I am *not* saying to use canny, that won't help, that'll only give you a bunch of points for ellipse fitting, and you could just as well pick those manually, with the mouse) – Christoph Rackwitz Jun 13 '22 at 06:58
  • Here is https://dsp.stackexchange.com/questions/2406/how-to-flatten-the-image-of-a-label-on-a-food-jar. Scroll to bottom. – toyota Supra Jun 13 '22 at 12:50
  • @ChristophRackwitz Thanks very much for these suggestions - I haven't gotten anything working yet, but I'll take a stab at the procedure you described. I will update the question once I'm a bit further along. – A.S. Jun 14 '22 at 03:04
  • I just noticed that my first comment is somehow missing a word... those equations *don't* tell you much, certainly not the concepts/ideas, just the *implementation*. that is to say, I totally understand how someone would be stumped by those equations. – Christoph Rackwitz Jun 14 '22 at 09:24

0 Answers0