在MATLAB中将像素值指定给图像中的非整数坐标

在MATLAB中将像素值指定给图像中的非整数坐标,matlab,grid,delaunay,spatial-interpolation,Matlab,Grid,Delaunay,Spatial Interpolation,萨拉姆 我有一个关于MATLAB中赋值的问题。我有一张5x5的图像,我想用delaunay三角剖分中的曲面逼近将其大小增加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 triNu

萨拉姆 我有一个关于MATLAB中赋值的问题。我有一张5x5的图像,我想用delaunay三角剖分中的曲面逼近将其大小增加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

我所做的是将我的整个网格乘以2。因为我的网格是1:0.5:5,所以非整数网格点是整数,我给它们分配了各自的值,因为所有列的第一行和所有行的第一列都是零,所以我使用这些命令行来删除额外的零行和零列

为我的黑客帝国

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

您应该使用插值根据非整数坐标处的强度查找整数值坐标的强度