cp2tform / tformfwd - are points outside controlpoints correctly transformed ?

11 ビュー (過去 30 日間)
Emmanuel
Emmanuel 2012 年 5 月 2 日
Hi,
I am getting erratic results when trying to transform a set of 2D points using cp2tform and tformfwd.
When the points to be transformed are situated outside the perimeter of controlpoints, I sometime get negative coordinates (ok knowing the position of my CP), but sometimes the transformed coordinates seem to default to (0,y) or (0,0).
I thought this was caused by the piecewise linear transformation I'm using (as matlab probably cannot draw triangles beyond CP limits), bu it seems I get the same behavior when using projective or polynomial transformations, and tformfwd or tforminv.
What surprises me the most is that I do not get any error or warning message when these outlier points are being (wrongly) transformed ...
Any ideas ?

採用された回答

Emmanuel
Emmanuel 2012 年 5 月 22 日
An update about the original question, after more torough tests:
- the problem I got initially was caused by my own code, sorry about that.
- however, If this can help anybody, I discovered that piecewise linear TFORM behaves strangely if control points describe a non-convex polygon, creating triangles with zero area in the output space. These triangles are transformed to a segment that seem to "attract" even points outside the cp polygon. I don't have the skills to test it properly, but this may suggest that piecewise linear transform might be unreliable in some cases, e.g. for processing images with barrel distorsion.
  1 件のコメント
Sean de Wolski
Sean de Wolski 2012 年 5 月 22 日
Good to know!
Please accept your answer to mark this thread closed.

サインインしてコメントする。

その他の回答 (2 件)

Sean de Wolski
Sean de Wolski 2012 年 5 月 2 日
How colinear are your control points? If the points are relatively colinear then the contraints in the perpendicular dimension will not be good.

Emmanuel
Emmanuel 2012 年 5 月 2 日
Thank you Sean,
I have 8 CP describing a rectangle in real coordinates:
X = 0 40 80 0 80 0 40 80 Y = 0 0 0 60 60 120 120 120
Is that too colinear ? should I remove some CP ? These are really all the CP I can have...
Is there a transformation type that would handle points outside this rectangle correctly ?

カテゴリ

Help Center および File ExchangeSpatial Search についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by