cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-106727%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8JMP%E9%80%B2%E8%A1%8C%E9%9B%99%E7%B7%9A%E6%80%A7%E6%8F%92%E5%80%BC%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-106727%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E6%9C%AC%E8%B3%AA%E4%B8%8A%E5%AE%83%E8%A2%AB%E7%A8%B1%E7%82%BA%E4%BA%8C%E7%B6%AD%E5%A4%9A%E5%85%83%E6%8F%92%E5%80%BC%E3%80%82%20%E6%88%91%E6%9C%89%E4%B8%80%E7%B5%84%E4%BD%8D%E7%BD%AE%20(x%2Cy)%20%E5%92%8C%E7%9B%B8%E6%87%89%E7%9A%84%E6%95%B8%E6%93%9A%EF%BC%8C%E4%BE%8B%E5%A6%82%EF%BC%9Az%3D%E9%A1%8F%E8%89%B2%E5%80%BC%E3%80%82%20%E5%B0%8D%E6%96%BC%E6%9F%90%E4%BA%9B%20(x%2Cy)%EF%BC%8Cz%20%E5%88%97%E7%BC%BA%E5%B0%91%E6%95%B8%E6%93%9A%E3%80%82%20%E6%88%91%E6%83%B3%E4%BD%BF%E7%94%A8%E6%9C%80%E8%BF%91%E7%9A%84%E5%85%A9%E5%80%8B%E5%B7%B2%E7%9F%A5%EF%BC%88x1%EF%BC%8Cy1%EF%BC%8Cz1%EF%BC%89%E5%92%8C%EF%BC%88x2%EF%BC%8Cy2%EF%BC%8Cz2%EF%BC%89%E4%BE%86%E6%8F%92%E5%80%BC%EF%BC%88x3%EF%BC%8Cy3%EF%BC%8Cz3%3D%EF%BC%9F%EF%BC%89%E3%80%82%3C%2FP%3E%3CP%3E%E7%90%86%E8%AB%96%E4%B8%8A%E9%80%99%E5%80%8B%3CA%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FBilinear_interpolation%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%E7%B6%AD%E5%9F%BA%2F%E9%9B%99%E7%B7%9A%E6%80%A7%E6%8F%92%E5%80%BC%3C%2FA%3E%E6%98%AF%E6%88%91%E5%96%9C%E6%AD%A1%E5%BE%97%E5%88%B0%E7%9A%84%E3%80%82%3C%2FP%3E%3CP%3EJMP%E6%9C%89%E8%BE%A6%E6%B3%95%E5%81%9A%E5%88%B0%E9%80%99%E4%B8%80%E9%BB%9E%E5%97%8E%EF%BC%9F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E5%8F%A6%E5%A4%96%EF%BC%8C%E6%88%91%E9%9C%80%E8%A6%81%E9%A6%96%E5%85%88%E6%8C%89%E5%8F%A6%E5%A4%96%E5%85%A9%E5%88%97%20A%E3%80%81B%20%E5%B0%8D%20X%E3%80%81Y%20%E6%95%B8%E6%93%9A%E9%80%B2%E8%A1%8C%E5%88%86%E7%B5%84%E3%80%82%E4%BE%8B%E5%AD%90%E3%80%82%20COl%20A%E3%80%81B%20%E4%BB%A3%E8%A1%A8%E6%96%87%E4%BB%B6%E5%90%8D%E5%92%8C%E5%B9%80%E8%99%9F%E3%80%82%20X%2CY%20%E6%98%AF%E5%83%8F%E7%B4%A0%E5%9C%A8%E5%B9%80%E4%B8%AD%E7%9A%84%E4%BD%8D%E7%BD%AE%EF%BC%8CZ%20%E6%98%AF%E5%83%8F%E7%B4%A0%E9%A1%8F%E8%89%B2%E3%80%82%3CBR%20%2F%3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5%B0%87%E9%9C%80%E8%A6%81%E5%9B%9B%E5%80%8B%E9%BB%9E%EF%BC%88%E8%80%8C%E4%B8%8D%E6%98%AF%E5%85%A9%E5%80%8B%EF%BC%89%E3%80%82%20%E5%88%86%E7%B5%84%E5%88%97%E7%9A%84%E8%99%95%E7%90%86%E6%9C%83%E5%BE%88%E6%B7%B7%E4%BA%82%EF%BC%8C%E5%9B%A0%E6%AD%A4%E5%B0%8D%E6%96%BC%E4%B8%80%E7%B5%84%EF%BC%8C%E6%82%A8%E5%8F%AF%E4%BB%A5%E5%9F%B7%E8%A1%8C%E4%BB%A5%E4%B8%8B%E6%93%8D%E4%BD%9C%EF%BC%9A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0A%0A%2F%2F%20Example%20table%3A%20Four%20complete%20observations%2C%20and%20one%20missing%20'Colour'%20to%20be%0A%2F%2F%20obtained%20by%20bilinear%20interpolation%0Adt%20%3D%20New%20Table(%20%22Antman_1%22%2C%0A%20%20%20Add%20Rows(%205%20)%2C%0A%20%20%20New%20Column(%20%22X%22%2C%0A%20%20%20%20Numeric%2C%0A%20%20%20%20%22Continuous%22%2C%0A%20%20%20%20Format(%20%22Best%22%2C%2012%20)%2C%0A%20%20%20%20Set%20Values(%20%5B0%2C%205%2C%203%2C%205%2C%200%5D%20)%0A%20%20%20)%2C%0A%20%20%20New%20Column(%20%22Y%22%2C%0A%20%20%20%20Numeric%2C%0A%20%20%20%20%22Continuous%22%2C%0A%20%20%20%20Format(%20%22Best%22%2C%2012%20)%2C%0A%20%20%20%20Set%20Values(%20%5B0%2C%205%2C%202%2C%200%2C%205%5D%20)%2C%0A%20%20%20%20Set%20Display%20Width(%2092%20)%0A%20%20%20)%2C%0A%20%20%20New%20Column(%20%22Colour%22%2C%0A%20%20%20%20Numeric%2C%0A%20%20%20%20%22Continuous%22%2C%0A%20%20%20%20Format(%20%22Best%22%2C%2012%20)%2C%0A%20%20%20%20Set%20Values(%20%5B255%2C%20195%2C%20.%2C%20100%2C%20150%5D%20)%0A%20%20%20)%0A%20%20)%3B%0A%0A%2F%2F%20Using%20the%20notation%20at%3A%20https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FBilinear_interpolation%0Ax1%20%3D%20dt%5B1%2C%20%22X%22%5D%3B%0Ax2%20%3D%20dt%5B2%2C%20%22X%22%5D%3B%0Ay1%20%3D%20dt%5B1%2C%20%22Y%22%5D%3B%0Ay2%20%3D%20dt%5B2%2C%20%22Y%22%5D%3B%0Aq11%20%3D%20dt%5B1%2C%20%22Colour%22%5D%3B%0Aq21%20%3D%20dt%5B4%2C%20%22Colour%22%5D%3B%0Aq12%20%3D%20dt%5B5%2C%20%22Colour%22%5D%3B%0Aq22%20%3D%20dt%5B2%2C%20%22Colour%22%5D%3B%0Ax%20%3D%20dt%5B3%2C%20%22X%22%5D%3B%0Ay%20%3D%20dt%5B3%2C%20%22Y%22%5D%3B%0A%0A%2F%2F%20Interpolate%20in%20the%20X%20direction%0Ar1%20%3D%20Interpolate(x%2C%20x1%2C%20q11%2C%20x2%2C%20q21)%3B%0Ar2%20%3D%20Interpolate(x%2C%20x1%2C%20q12%2C%20x2%2C%20q22)%3B%0A%0A%2F%2F%20Interpolate%20in%20the%20Y%20direction%0Ap%20%3D%20Interpolate(y%2C%20y1%2C%20r1%2C%20y2%2C%20r2)%3B%0AWait(3)%3B%0Adt%5B3%2C%20%22Colour%22%5D%20%3D%20p%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E9%80%99%E4%B8%8D%E5%A4%AA%E5%8F%AF%E8%83%BD%E6%98%AF%E2%80%9C%E6%9C%80%E4%BD%B3%E2%80%9D%E6%96%B9%E6%B3%95%EF%BC%8C%E4%BD%86%E7%82%BA%E4%BA%86%E5%81%9A%E5%BE%97%E6%9B%B4%E5%A5%BD%EF%BC%8C%E9%9C%80%E8%A6%81%E4%B8%80%E4%BA%9B%E7%A4%BA%E4%BE%8B%E6%95%B8%E6%93%9A%EF%BC%88%E5%9C%A8%20JMP%20%E8%A1%A8%E4%B8%AD%EF%BC%89%E3%80%82%20%E6%82%A8%E9%82%84%E9%9C%80%E8%A6%81%E6%B1%BA%E5%AE%9A%E5%A6%82%E4%BD%95%E8%99%95%E7%90%86%E9%82%8A%E7%B7%A3%E6%83%85%E6%B3%81%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
smostafa
Level I

How to do Bilinear Interpolation using JMP?

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=?). 

Theoretically this wiki/Bilinear_interpolation is what I like to get. 

Does JMP has a way of doing this? 

 

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. 

I want to interpolate the Z value for missing pixels in each frame in each file. 
Sample Data set

FileFrameXYColor
Antman100255
Antman155195
Antman132??
Antman200255
Batman300255
Batman332??
Batman355100




1 REPLY 1
ian_jmp
Level X

Re: How to do Bilinear Interpolation using JMP?

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:

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;

 

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.

Recommended Articles