0

salam i am having an issue regarding assigning of value in MATLAB. i have a 5x5 image, i want to increase its size by 2 using surface approxiation in delaunay triangulation i used a bivariate polynomial for interpolation , for each triangle 9 constants are calculated now i have to define a new grid and find the location of grid poit in triangulation then use those constants for calculation of pixel value on new coordinates,but the pixel values calculated for non integer coordinates cannot be allocated to new image

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
Jav
  • 43
  • 8
  • 2
    You should be using interpolation to find the intensities for integer valued coordinates based on your intensities at non-integer coords – Dan Jan 16 '14 at 13:15

1 Answers1

0

what i did id that i multiplied my whole grid by 2.As i was having grid from 1:0.5:5,so the non integer grid points got integer i assigned them their respective value, as the first row of all columns and first column of all rows get zero using this so i used these command lines to delete that extra zero row and column

for my matrix S

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

Jav
  • 43
  • 8