我正在使用imtransform来扭曲图像,使用exploring a conformal mapping中提出的保形贴图。它工作正常,但Matlab显示警告不建议使用imtransform,而应该使用imwarp,但是从imtransform到imwarp的转换很困难。有人可以在几何变换对象中使用intransform [a]转移失真过程以获得imwarp吗?
[a]这将RGB图像C转换为T
conformal = maketform('custom', 2, 2, [], @conformalInverse, []);
T = imtransform(C, conformal, 'bicubic', 'UData', uData,'VData', vData, 'XData', xData,'YData', yData, 'Size', [cm_out_h cm_out_w], 'FillValues', FillValue);
使用conformalInverse.m中定义的共形映射公式,如:
function U = conformalInverse(X, ~)
%#codegen
U = [zeros(size(X))];
Z = complex(X(:,1),X(:,2));
a = 2; W = (1./(4 * Z.^a - 1));
U(:,2) = imag(W);
U(:,1) = real(W);
和一些参数值示例如:
uData = [ -1.25 1.25]; % Bounds for REAL(w)
vData = [ 0.75 -0.75]; % Bounds for IMAG(w)
xData = [ -2.00 2.00]; % Bounds for REAL(z)
yData = [ 2.00 -2.00]; % Bounds for IMAG(z)
cm_out_h = 3000; % h of output image
cm_out_w = 3000; % w of output image
FillValue = 0; % color definition to fill possible empty areas; here 0 == black