bilinear-interpolation

Inverting a real-valued index grid

此生再无相见时 提交于 2019-11-28 23:02:56
问题 OpenCV's remap() uses a real-valued index grid to sample a grid of values from an image using bilinear interpolation, and returns the grid of samples as a new image. To be precise, let: A = an image X = a grid of real-valued X coords into the image. Y = a grid of real-valued Y coords into the image. B = remap(A, X, Y) Then for all pixel coordinates i, j, B[i, j] = A(X[i, j], Y[i, j]) Where the round-braces notation A(x, y) denotes using bilinear interpolation to solve for the pixel value of

Inverse Bilinear Interpolation?

試著忘記壹切 提交于 2019-11-28 16:32:54
I have four 2d points, p0 = (x0,y0), p1 = (x1,y1), etc. that form a quadrilateral. In my case, the quad is not rectangular, but it should at least be convex. p2 --- p3 | | t | p | | | p0 --- p1 s I'm using bilinear interpolation. S and T are within [0..1] and the interpolated point is given by: bilerp(s,t) = t*(s*p3+(1-s)*p2) + (1-t)*(s*p1+(1-s)*p0) Here's the problem.. I have a 2d point p that I know is inside the quad. I want to find the s,t that will give me that point when using bilinear interpolation. Is there a simple formula to reverse the bilinear interpolation? Thanks for the

Obtain function from akima::interp() matrix

懵懂的女人 提交于 2019-11-28 12:41:48
Using the interp function (Akima package), it is possible to draw the surface corresponding to the bivariate interpolation of a data set, see example below (from interp documentation): library(rgl) data(akima) # data visualisation rgl.spheres(akima$x,akima$z , akima$y,0.5,color="red") rgl.bbox() # bivariate linear interpolation # interp: akima.li <- interp(akima$x, akima$y, akima$z, xo=seq(min(akima$x), max(akima$x), length = 100), yo=seq(min(akima$y), max(akima$y), length = 100)) # interp surface: rgl.surface(akima.li$x,akima.li$y,akima.li$z,color="green",alpha=c(0.5)) However, the output is

Inverse Bilinear Interpolation?

余生颓废 提交于 2019-11-27 19:54:44
问题 I have four 2d points, p0 = (x0,y0), p1 = (x1,y1), etc. that form a quadrilateral. In my case, the quad is not rectangular, but it should at least be convex. p2 --- p3 | | t | p | | | p0 --- p1 s I'm using bilinear interpolation. S and T are within [0..1] and the interpolated point is given by: bilerp(s,t) = t*(s*p3+(1-s)*p2) + (1-t)*(s*p1+(1-s)*p0) Here's the problem.. I have a 2d point p that I know is inside the quad. I want to find the s,t that will give me that point when using bilinear

Obtain function from akima::interp() matrix

青春壹個敷衍的年華 提交于 2019-11-27 07:15:28
问题 Using the interp function (Akima package), it is possible to draw the surface corresponding to the bivariate interpolation of a data set, see example below (from interp documentation): library(rgl) data(akima) # data visualisation rgl.spheres(akima$x,akima$z , akima$y,0.5,color="red") rgl.bbox() # bivariate linear interpolation # interp: akima.li <- interp(akima$x, akima$y, akima$z, xo=seq(min(akima$x), max(akima$x), length = 100), yo=seq(min(akima$y), max(akima$y), length = 100)) # interp