DivineDesert
DivineDesert

Reputation: 6954

Shephard Distortion for 2 control points distorts entire image - ImageMagick Iphone sdk

I am trying to implement Shephards distortion in iphone. Following is my code:

const double ctrlPts[8] = {125,200 ,150,150, 255,150, 150, 150};
const size_t q = 8;
MagickDistortImage(magick_wand, ShepardsDistortion , q, ctrlPts, MagickFalse);

Following is my result

First One is original Image and second one is distorted image.

Original Image Distorted Image

I just want to move one pixel to other location. I am not able to figure out where I am making mistake.

I am trying to give Multi-Point and Freeform Distorts from this link

Upvotes: 2

Views: 464

Answers (1)

deanWombourne
deanWombourne

Reputation: 38475

Is it simply because you're dragging the image into the center slightly and it doesn't what to put in the gap?

Try setting the corners to be fixed :

const double ctrlPts[24] = {
  // Points to move
  125,200 ,150,150, 255,150, 150, 150,

  // Points to fix
  0,0,0,0,   320,0,320,0,   320,460,320,460,    0,460,0,460
};

Upvotes: 1

Related Questions