My finding is that horizontal "compression" at the left and right edges of the cylinder is way too low and the rendered picture lacks impression of real cylinder (though vertical transformations are OK). In other words, horizontal compression is nearly linear, but it should not be.
Original picture:
What i get is this:
script:
Code: Select all
convert orig.png -background white -gravity south -splice 0x50 \
\( +clone -sparse-color barycentric '-50,0 black 600,0 white' \) \
\( +clone -function arcsin 0.5 \) \
\( -clone 1 -level 25%,75% \
-function polynomial -4,4,0 -gamma 2 +level 50%,0 \) \
-delete 1 -swap 0,1 miff:- | \
composite - -virtual-pixel white -displace 10x40 out.jpg
The result i wish is more like this:
script:
Code: Select all
./cylinderize -m vertical -p 20 -w 80 orig.png out2.jpg
My question is, is there a simple way to modify this "cylindrical displacement" script to apply more realistic horizontal compression? As we can see compression overall exists, but way too low, and i can't find a way to adjust it. Or does this script in essence lacks functionality to achieve this goal?
I am trying to change various params of the script, but with no success (i treat the script as black box and change params intuitevily only, since i do not understand fully what transformations are made). I figured out, that if i change 'arcsin 0.5' to, say, 'arcsin 0.1' i get impact to horizontal compression, but the opposite way i want! I get this:
Code: Select all
convert orig.png -background white -gravity south -splice 0x50 \
\( +clone -sparse-color barycentric '-50,0 black 600,0 white' \) \
\( +clone -function arcsin 0.1 \) \
\( -clone 1 -level 25%,75% \
-function polynomial -4,4,0 -gamma 2 +level 50%,0 \) \
-delete 1 -swap 0,1 miff:- | \
composite - -virtual-pixel white -displace 10x40 out.jpg
I looked for other ways to solve problem, like adjusting horizontal compression in extra transformation step, like here:
http://www.imagemagick.org/Usage/mappin ... rtion_maps
But performance was even poorer than that of Cylinderize script.