Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Recent attempts at unrolling bottle labels
#1
  • Worked out the math to generate a displace map
  • Figured out that Gimp displace map doesn't work at all as described in the doc
  • Worked out some more math to generate a displace map that pleases Gimp
  • Eventually got some satisfactory results
From this:
   
To this:
   

Now to script the whole thing.
Reply
#2
At first I had the impression that the ratio of height x width had been lost. (That the can would have been flattened)
But it's just an impression, caused by the expansion of the unrolled sides.

Will the reverse operation also be possible? - Create the flat label and produce its rolled version?

It is clearly visible in the curvatures (upper and lower) an accentuated pixelation.

The sharpness obtained was excellent!
                               .....
Samj PortableGimp 2.10.28 - Win-10 /64.
Reply
#3
(12-09-2022, 04:24 PM)Krikor Wrote: At first I had the impression that the ratio of height x width had been lost. (That the can would have been flattened)
But it's just an impression, caused by the expansion of the unrolled sides.

Will the reverse operation also be possible? - Create the flat label and produce its rolled version?

It is clearly visible in the curvatures (upper and lower) an accentuated pixelation.

The sharpness obtained was excellent!

The loss of aspect ratio is perceptual.Technically, the final result should be 1.57x (π/2) wider than the bottle/can. It is however possible that the original design uses a slightly widened  aspect ratio to account for the perceptual  shrink cause by the wrapping on a cylinder.

Yes, doing the same to wrap on cylinder is quite easy (easier than Filters ➤ Map to object (cylinder), but without some perspective effects of course).

Pixels on the edges are stretched over 10x.
Reply
#4
Making some progress with the scripts, as well as shot some family-friendly test cases.

From:

   

To:

   

And with a bit of median blur:

   

Passes an important acid test: the three e in Pamplemousses Roses end up with pretty much the same shape. Also, surprised how well a light amount of median blur fixes the bluriness...
Reply
#5
Ofnuts; nice results so far, waiting to see the script. (and now, time for some 'pamplemousse' juce ...)
Reply
#6
(12-23-2022, 08:07 AM)denzjos Wrote: Ofnuts; nice results so far, waiting to see the script. (and now, time for some 'pamplemousse' juce ...)

Still plenty of things to test, such as influence of the dithering/subsampling parameters of the gradient, influence of image precision, creating the gradient on the fly... Since I retired I spend much less time in boring meetings so I have less time to code  Big Grin .
Reply
#7
Looks great!
Reply
#8
Good progress.

Reshot the bottle, optimizing for geometry. The farther you are, the less difference between middle and corners. So I shot the bottle from 3 meters away, using my 400mm lens. Also made sure that I was level (spoiler alert: the label on the bottle is slightly canted...).

   

Further testing showed that I was victim of some Gimp cleverness. When you do a grayscale gradient, the pixels aren't pure gray, there is some randomness in the hue and this isn't good for the displace map. Once I managed to turn this off, results are pretty good. This is the raw result (no need for median filtering this time).

     

The last two letters of Roses look off because they are actually layers with copies the first e and s in Pamplemousses and there is a difference in lighting. But the (slightly) corrected shape of these letters near perfectly matches the (very) corrected shapes of the last two, which is proof that the technique works. "SOURCE DE VITAMINE C` also becomes a near-perfect circle.

Now to create an even more precise gradient on the fly...
Reply


Forum Jump: