を倍増私は、このエラーが何を意味するかまたはそれを修正する方法がわかりません。別の座標空間でイメージの回転を実行しようとしています。行列の参照空間をゼロにすると、整数は同じクラスまたはスカラ倍の整数でしか扱うことができないというエラーが発生します。行は整数は、同じクラスまたはスカラーの整数と組み合わせることができ、エラー
WZcentered = WZ - [x0;yo]*ones(1,Ncols);
です。作業領域では、WZは400x299x3ユニット8に分類されます。それはイメージです。関数が呼び出されると、x0とy0は0に設定されます。この問題を解決するにはどうすればよいですか/ここでは何が起こっていますか?私は同じことを行うときにも
、まだ私はというエラーを取得WZが倍に等しくなるように(WZ)を作る「行列の次元が同意する必要があります。」私は二重機能が何をしているのかは分かりません。ここにコード全体があります。
function [out_flag, WZout, x_final, y_final] = adopted_moveWZ(WZ, x0, y0);
%Initial Test of plot
[Nrows,Ncols]=size(WZ);
if Nrows ~= 2
if Ncols ==2
WZ=transpose(WZ); %take transpose
[Nrows,Ncols]=size(WZ); %reset the number of rows and columns
else
fprintf('ERROR: Input file should have 2-vectors for the input points.\n');
end
end
plot(WZ(1,:),WZ(2,:),'.')
title('These are the original points in the image');
pause(2.0)
%WZorig = WZ;
%centering
WZcentered = WZ - ([x0;y0] * ones(1,Ncols));
FigScale=400;
axis([-FigScale 2*FigScale -FigScale 2*FigScale])
disp('Hit any key to start the animation');
pause;
SceneCenter = zeros(Nrows,Ncols);
WZnew = WZcentered;
for ii=0:20
%rotate
R = [cos(pi/ii) -sin(pi/ii) 0; sin(pi/ii) cos(pi/ii) 0; 0 0 1];
WZnew = R * WZnew;
plot(WZnew(1,:),WZnew(2,:),'.')
%place WZnew at a different place in the scene
SceneCenter = (ii*[30;40])*ones(1,Ncols);
plot(SceneCenter(1,:) + WZnew(1,:), SceneCenter(2,:) + WZnew(2,:),'.')
axis([-FigScale 2*FigScale -FigScale 2*FigScale])
pause(1.0);
end
%Set final values for output at end of program
x_final = SceneCenter(1,1);
y_final = SceneCenter(2,1);
PPout = PPnew + SceneCenter;