20060727-Spatial transformations: Handling noninvertible cases

本文探讨了在使用cp2tform进行空间变换时遇到的非可逆映射问题,并通过一个多项式变换的例子展示了如何处理这种情况。对于无法直接获得前向变换的情况,介绍了findbounds如何通过搜索来确定输出图像的边界。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文:http://blogs.mathworks.com/steve/2006/07/27/spatial-transformations-handling-noninvertible-cases/

But what about noninvertible mappings? For example, the function cp2tform can produce several types of spatial transformations that aren't invertible. It can infer a polynomial transformation from a set of control points:

pairs1 = [1 1; 5 21; 17 40; 28 1; 32 20; 45 40; 72 1; 77 20; 90 40];
pairs2 = [1 1; 1 21; 1 40; 20 1; 20 20; 20 40; 40 1; 40 20; 40 40];
t_poly = cp2tform(pairs1, pairs2, 'polynomial',2);
I = checkerboard(10, 2);
J = imtransform(I,t_poly);

subplot(1,2,1)
imshow(I), title('checkerboard')

subplot(1,2,2)
imshow(J), title('polynomial transformation')
But the polynomial transformation isn't invertible. Since imtransform uses inverse mapping and so must have at least the inverse transformation, cp2tform produces a tform structure where the polynomial transformation is used in the inverse direction, and the structure contains nothing for the forward direction.

If there's no forward transformation available, then how does findbounds work? That is, how does it find the bounding rectangle of the image in output space?

It does it by using a search. Specifically, for an input-space location u, it uses fminsearch to find the output-space location x that minimizes:

It's possible fminsearch might fail to converge, in which case findbounds issues a warning message and "guesses" that the output image's bounding rectangle is the same as the input image's bounding rectangle.

If you're interested in the details, look at the find_bounds_using_search subfunction inside findbounds.m.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值