Gimp-Forum.net
Recent attempts at unrolling bottle labels - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: Other topics (https://www.gimp-forum.net/Forum-Other-topics)
+--- Forum: Watercooler (https://www.gimp-forum.net/Forum-Watercooler)
+--- Thread: Recent attempts at unrolling bottle labels (/Thread-Recent-attempts-at-unrolling-bottle-labels)



Recent attempts at unrolling bottle labels - Ofnuts - 12-09-2022

  • 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:
[attachment=9144]
To this:
[attachment=9145]

Now to script the whole thing.


RE: Recent attempts at unrolling bottle labels - Krikor - 12-09-2022

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!


RE: Recent attempts at unrolling bottle labels - Ofnuts - 12-10-2022

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


RE: Recent attempts at unrolling bottle labels - Ofnuts - 12-19-2022

Making some progress with the scripts, as well as shot some family-friendly test cases.

From:

[attachment=9173]

To:

[attachment=9174]

And with a bit of median blur:

[attachment=9175]

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


RE: Recent attempts at unrolling bottle labels - denzjos - 12-23-2022

Ofnuts; nice results so far, waiting to see the script. (and now, time for some 'pamplemousse' juce ...)


RE: Recent attempts at unrolling bottle labels - Ofnuts - 12-23-2022

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


RE: Recent attempts at unrolling bottle labels - meetdilip - 12-23-2022

Looks great!


RE: Recent attempts at unrolling bottle labels - Ofnuts - 01-15-2023

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

[attachment=9240]

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

 [attachment=9241]

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