Shearing results different between using "imtransform" and "tformarray"

6 次查看(过去 30 天)
Hi, guys. Recently I want to conduct a shearing transform on a 4D object, and I found "tformarray" function seemed to be a good choice. Since I never used that function before, and to verify also to learn it, I tesed the same image using "imtransform" and "tformarray" respectively. But I received different results: "tformarray" result had a slight shift position compared to the one produced by "imtransform". I was wondering if "tformarray" needed some "prior transforms" to yield the same result as the "imtransform".
And my code has been listed as following. You can see what did I get. Please read and make a reply. Thank you.
clc;close all;clear all;
% original picture generalization
I = checkerboard(40,1,1);
sizeI = size(I);
figure; imshow(I,'InitialMagnification','fit')
title('original picture');
% shearing
alpha = 0.9;
B = [1/alpha 1-1/alpha 0; 0 1 0; 0 0 1];
xform = B;
% using imtransform
T1 = maketform('affine',B);
J = imtransform(I,T1);
figure; imshow(J,'InitialMagnification','fit');
title('imtransform');
% using tformarray
T2 = maketform('affine',xform);
R = makeresampler('cubic','circular');
fill = 0.3;
J1 = tformarray(I,T2,R,[2 1],[2 1], [89, 89], [], fill);
figure; imshow(J1,'InitialMagnification','fit');
title('tformarray');
  1 个评论
aa
aa 2014-10-23
Hey! Did u find out what was happening? I am using tformarray and my results are also slightly shifted...But I don't know why. I guess the problem comes from the matrix of the transformation, that is T2 in your example...Do you have any idea of how to fix it? Thanks

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Computer Vision with Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by