topic How to do Bilinear Interpolation using JMP? in Discussions
https://community.jmp.com/t5/Discussions/How-to-do-Bilinear-Interpolation-using-JMP/m-p/106727#M39058
<P>Essentially it is called 2D multivariate interpolation. I have set of locations (x,y) and a corresponding data eg: z=color value. For some of the (x,y) the z column has data missing. I want to use the nearest two known ( x1,y1,z1) and (x2,y2,z2) to interpolate the value for (x3,y3, z3=?). </P><P>Theoretically this <A href="https://en.wikipedia.org/wiki/Bilinear_interpolation" target="_self">wiki/Bilinear_interpolation</A> is what I like to get. </P><P>Does JMP has a way of doing this? </P><P> </P><P>Also I need first group the X,Y data by two other column A,B. Example. COl A,B represents filename and frame number. X,Y is the location of a pixel in the frame and Z is the pixel color. <BR /><BR />I want to interpolate the Z value for missing pixels in each frame in each file. <BR />Sample Data set</P><TABLE><TBODY><TR><TD>File</TD><TD>Frame</TD><TD>X</TD><TD>Y</TD><TD>Color</TD></TR><TR><TD>Antman</TD><TD>1</TD><TD>0</TD><TD>0</TD><TD>255</TD></TR><TR><TD><SPAN>Antman</SPAN></TD><TD>1</TD><TD>5</TD><TD>5</TD><TD>195</TD></TR><TR><TD><SPAN>Antman</SPAN></TD><TD>1</TD><TD>3</TD><TD>2</TD><TD>??</TD></TR><TR><TD><SPAN>Antman</SPAN></TD><TD>2</TD><TD>0</TD><TD>0</TD><TD>255</TD></TR><TR><TD>Batman</TD><TD>3</TD><TD>0</TD><TD>0</TD><TD>255</TD></TR><TR><TD>Batman</TD><TD>3</TD><TD>3</TD><TD>2</TD><TD>??</TD></TR><TR><TD>Batman</TD><TD>3</TD><TD>5</TD><TD>5</TD><TD>100</TD></TR></TBODY></TABLE><P><BR /><BR /><BR /></P>Thu, 17 Jan 2019 02:19:24 GMTsmostafa2019-01-17T02:19:24ZHow to do Bilinear Interpolation using JMP?
https://community.jmp.com/t5/Discussions/How-to-do-Bilinear-Interpolation-using-JMP/m-p/106727#M39058
<P>Essentially it is called 2D multivariate interpolation. I have set of locations (x,y) and a corresponding data eg: z=color value. For some of the (x,y) the z column has data missing. I want to use the nearest two known ( x1,y1,z1) and (x2,y2,z2) to interpolate the value for (x3,y3, z3=?). </P><P>Theoretically this <A href="https://en.wikipedia.org/wiki/Bilinear_interpolation" target="_self">wiki/Bilinear_interpolation</A> is what I like to get. </P><P>Does JMP has a way of doing this? </P><P> </P><P>Also I need first group the X,Y data by two other column A,B. Example. COl A,B represents filename and frame number. X,Y is the location of a pixel in the frame and Z is the pixel color. <BR /><BR />I want to interpolate the Z value for missing pixels in each frame in each file. <BR />Sample Data set</P><TABLE><TBODY><TR><TD>File</TD><TD>Frame</TD><TD>X</TD><TD>Y</TD><TD>Color</TD></TR><TR><TD>Antman</TD><TD>1</TD><TD>0</TD><TD>0</TD><TD>255</TD></TR><TR><TD><SPAN>Antman</SPAN></TD><TD>1</TD><TD>5</TD><TD>5</TD><TD>195</TD></TR><TR><TD><SPAN>Antman</SPAN></TD><TD>1</TD><TD>3</TD><TD>2</TD><TD>??</TD></TR><TR><TD><SPAN>Antman</SPAN></TD><TD>2</TD><TD>0</TD><TD>0</TD><TD>255</TD></TR><TR><TD>Batman</TD><TD>3</TD><TD>0</TD><TD>0</TD><TD>255</TD></TR><TR><TD>Batman</TD><TD>3</TD><TD>3</TD><TD>2</TD><TD>??</TD></TR><TR><TD>Batman</TD><TD>3</TD><TD>5</TD><TD>5</TD><TD>100</TD></TR></TBODY></TABLE><P><BR /><BR /><BR /></P>Thu, 17 Jan 2019 02:19:24 GMThttps://community.jmp.com/t5/Discussions/How-to-do-Bilinear-Interpolation-using-JMP/m-p/106727#M39058smostafa2019-01-17T02:19:24ZRe: How to do Bilinear Interpolation using JMP?
https://community.jmp.com/t5/Discussions/How-to-do-Bilinear-Interpolation-using-JMP/m-p/106912#M39072
<P>If I understand correctly, you will need four points (not two) for the bilinear interpolation. The grouping columns would be wasily dealt with, so for one group you could do something like:</P>
<PRE><CODE class=" language-jsl">Names Default To Here( 1 );
// Example table: Four complete observations, and one missing 'Colour' to be
// obtained by bilinear interpolation
dt = New Table( "Antman_1",
Add Rows( 5 ),
New Column( "X",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0, 5, 3, 5, 0] )
),
New Column( "Y",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0, 5, 2, 0, 5] ),
Set Display Width( 92 )
),
New Column( "Colour",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [255, 195, ., 100, 150] )
)
);
// Using the notation at: https://en.wikipedia.org/wiki/Bilinear_interpolation
x1 = dt[1, "X"];
x2 = dt[2, "X"];
y1 = dt[1, "Y"];
y2 = dt[2, "Y"];
q11 = dt[1, "Colour"];
q21 = dt[4, "Colour"];
q12 = dt[5, "Colour"];
q22 = dt[2, "Colour"];
x = dt[3, "X"];
y = dt[3, "Y"];
// Interpolate in the X direction
r1 = Interpolate(x, x1, q11, x2, q21);
r2 = Interpolate(x, x1, q12, x2, q22);
// Interpolate in the Y direction
p = Interpolate(y, y1, r1, y2, r2);
Wait(3);
dt[3, "Colour"] = p;</CODE></PRE>
<P> </P>
<P>This is unlikely to be the 'best' way, but to do better some sample data (in a JMP table) would be required. You would also need to decide how to handle edge cases.</P>Thu, 17 Jan 2019 16:16:34 GMThttps://community.jmp.com/t5/Discussions/How-to-do-Bilinear-Interpolation-using-JMP/m-p/106912#M39072ian_jmp2019-01-17T16:16:34Z