MATLAB: How do you use ‘polynomial’, ‘piecewise linear’ or ‘lwm’ with the ‘fitgeotrans’ function

Image Processing Toolbox

Do you know how I can build a transform with ‘polynomial’, ‘piecewise linear’ or ‘lwm’ in the ‘fitgeotrans’ function?

Best Answer

To get the 'polynomial', 'piecewiselinear' or 'lwn' points, you need to have at least as many specified control points for the transformations. Assuming that there are 6 points in 'movingPoints' ans 'fixedPoints', then the calls look like:
pl = fitgeotrans(movingPoints,fixedPoints,'polynomial',2)
pwl = fitgeotrans(movingPoints,fixedPoints,'pwl')
lwm = fitgeotrans(movingPoints,fixedPoints,'lwm', 6)
You can find control points in many ways, including using the 'cpselect' tool.
Here is an example with some dummy points:
im1 = checkerboard;
im2 = imrotate(im1,30);
fixedPoints = ...
[11.0000 11.0000;
41.0000 71.0000;
70.6261 10.3739;
50.8784 30.4099;
20.7523 40.3559;
65.4369 65.5811];
movingPoints = ...
[14.0000 44.0000;
70.0000 81.0000;
66.5991 14.8694;
59.2658 42.0225;
38.6532 64.6171;
89.9865 64.6171];
pl = fitgeotrans(movingPoints,fixedPoints,'polynomial',2)
pwl = fitgeotrans(movingPoints,fixedPoints,'pwl')
lwm = fitgeotrans(movingPoints,fixedPoints,'lwm', 6)
Please visit the following link for additional information: