0

salam MATLAB での値の割り当てに関して問題があります。私は 5x5 の画像を持っています。私は delaunay 三角測量で表面近似を使用してそのサイズを 2 だけ増やしたいと思っています 補間に 2 変数多項式を使用しました。三角形ごとに 9 つの定数が計算されました。新しいグリッドを定義し、グリッド ポイントの位置を見つける必要があります。三角測量では、新しい座標のピクセル値の計算にこれらの定数を使用しますが、非整数座標で計算されたピクセル値を新しい画像に割り当てることはできません

for R=2 and N1 and N2=5
%defining new grid
[X,Y] = meshgrid(1:1/R:N2,1:1/R:N1);

for triNum = 6 %i select a triangle
    pts = r(tri(triNum,:),:); %gives the three vertices of triangle (x,y,z) of each
    IN = inpolygon(X,Y,pts(:,1),pts(:,2));  % NxM%checks which point of X,Y are in that %triangle
    HRtriangles(ind2sub(size(IN),find(IN==1))) = triNum;  %assign the triangle number to a %new matrix, %hr triangls gives the HRgrid the num of triangle each grid point is

  points=[X(ind2sub(size(IN),find(IN==1))),Y(ind2sub(size(IN),find(IN==1)))] %find value Tof coordinates which ar in that triangle
    HRptC = c(HRtriangles(ind2sub(size(IN),find(IN==1))),: ); % a little error here because out of %32 triangles having 9 c values each i have to find the triangle containing points

% HRimage(points(:,1),points(:,2)) = sum(HRptC.*[1,points(:,1),points(:,2),points(:,1)^2,points(:,2)^2,points(:,1)^3,(x^2)*points(:,2),points(:,1)*(points(:,2)^2),points(:,2)^3]);
%main error here because HRimage is the image i have to form but for example for point %(1.5,1) i want to assign pixel value but due to non integer value of coordinate it cannot %be assigned



end
4

1 に答える 1

0

私がしたことは、グリッド全体に2を掛けたことです.1:0.5:5からグリッドを持っていたので、非整数グリッドポイントは整数になり、すべての列の最初の行と最初の列としてそれぞれの値を割り当てましたこれを使用してすべての行がゼロになるため、これらのコマンドラインを使用して余分なゼロの行と列を削除しました

私の行列S

S( ~any(S,2), : ) = []; %rows S( :, ~any(S,1) ) = []; %列

于 2014-01-18T16:44:18.430 に答える