1

When I used Plane2Cylinder distortion I got Image like below. But I want the effect like second image. Please go through my code.

local nelem = 1 -- number of args
local arg = ffi.new("const double[?]", nelem, {100})
-- local methos = ffi.new("const int", 15)
return handle_result(self, lib.MagickDistortImage(self.wand,13, nelem, arg, 1))

ffi.cdef([[  typedef void MagickWand;
typedef void PixelWand;
MagickBooleanType MagickDistortImage(MagickWand *wand, DistortMethod method, const size_t, const double *args, const MagickBooleanType bestfit);

enter image description here enter image description here

UPDATE: for fred's script I used below command

bash -x ./cylinderize.sh -m vertical -r 366.34955984688 -l 188.179 -w 16.6667 -p 23.428692808745 -n 96.097053534591 -e 1.75 -a 0 -v background -b none -f none -o -86-80.8315 single_color.png single_color.j.png

Below is my modified image.

enter image description here

Rahul
  • 1,013
  • 1
  • 10
  • 24

1 Answers1

0

More of a comment than an answer.

  1. Looks like the distortion arguments only has field-of-view value set (100), but is missing the center X & Y values.

  2. Plane2Cylinder is only half of the distortion needed. The subject (mug) is not a perfect cylinder, so an additional slight-distortion (perhaps Perspective) will need to be applied to match the suffice pitch.

emcconville
  • 23,800
  • 4
  • 50
  • 66
  • Actually I applied distortion on only that black logo and place onto mug. The second image is the result from Fred's script. Sorry I don't understand it completely but I want to know that is there a possibility to get the result like second image using Plane2Cylinder distortion? – Rahul Apr 13 '17 at 13:16
  • Can you update the question with the arguments used to achieve the results of Fred's script + source images? Might help – emcconville Apr 13 '17 at 13:18
  • 2
    Plane2cylinder was designed for a specific kind of camera. It was not designed to do what you want. You can use my script, cylinderize, if you are on a Unix-like system. – fmw42 Apr 15 '17 at 00:03