tf_ThinPlateSpline icon indicating copy to clipboard operation
tf_ThinPlateSpline copied to clipboard

clarification for the relative coordinates of the control points

Open sedghi opened this issue 6 years ago • 2 comments

For ThinPlateSpline2, two of the arguments are: source, and target and it is written in the readme they are Relative coordinates of the source points (source) and Relative coordinates of the target points (target). In the example given, source points are

s_ = np.array([ # source position
  [-0.5, -0.5],
  [0.5, -0.5],
  [-0.5, 0.5],
  [0.5, 0.5]])

and target points are :

t_ = np.array([ # target position
  [-0.3, -0.3],
  [0.3, -0.3],
  [-0.3, 0.3],
  [0.3, 0.3]])

If we assume the (0,0) is center of the image, then each source point is traveling towards the center (e.g., for first control point from (-0.5,-0.5) to (-0.3,-0.3)); hence I expected the resulted image will be shrinked, but apparently it is not true and it is actually the other way around. Am I missing something? what is the coordinate system for the image?

Any help is appreciated

sedghi avatar Oct 10 '19 20:10 sedghi

Yeah, I agree that it can mislead users. The second version is implemented based on the first version. In the first version, coord samples pixel pointed by vector from coord position. In the second version, target is pointed by source with an implicit vector map. Therefore, I named it source and target, not target and source. You can simply think that source=coord and coord+vector=target

iwyoo avatar Oct 11 '19 08:10 iwyoo

Thank you for your explanation, I really appreciate your prompt reply

sedghi avatar Oct 14 '19 20:10 sedghi