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

조회 수: 6 (최근 30일)
caoccw
caoccw 2014년 3월 30일
댓글: aa 2014년 10월 23일
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