Questions tagged [bilinear-interpolation]

89 questions
0
votes
0 answers

What type of interpolation to use? For resizing a 480x395 texture into a 320x240 window

ppm file that is 480 pixels wide by 395 pixels in height into a SDL window of size 320 pixels wide by 240 pixels high. I am using C++ and individual pixel coloring by 2D index in window. Any ideas are welcome And thanks
0
votes
1 answer

understanding the torch.nn.functional.grid_sample op by concrete example

I am debugging a neural network which has a torch.nn.functional.grid.sample operator inside. Using the Pycharm IDE, I can watch the values during debugging. My grid is a 1*15*2 tensor, here are the values in the first batch. My input is a…
user9875189
  • 179
  • 1
  • 2
  • 10
0
votes
1 answer

Bilinear interpolation on quadrilateral

I am interpolating data from the vertices of a quadrilateral to any random point inside the quadrilateral. I implement this by first doing a coordinate transformation which reshapes the quadrilateral to a unit square and then using bilinear…
0
votes
0 answers

Interpolation along a BSpline

I have a very simple Bspline-- it's two points, in/out normals pointing at each other. In fact, just a line. I wrote a little for-next loop to get positions along the spline, like so: for (float…
KiraHoneybee
  • 495
  • 3
  • 12
0
votes
1 answer

Bilinear interpolation - point outside of the grid

Suppose I have a 10x10 pixel grid. Assume that each pixel has value 1 (it is not important). Now in the typical case, if I would like to sample a point inside of the grid, for example p1=(0.5,0.5)=(x,y), then we can apply bilinear interpolation…
phil
  • 225
  • 1
  • 4
  • 13
0
votes
1 answer

Using PyTorch grid_sample to reconstruct left image from right image and inverse depth

I'm implementing the basic architecture from this paper: https://arxiv.org/pdf/1705.08260.pdf in PyTorch. It consists of an autoencoder and Spatial Transformer. Output of the autoencoder is fed into the ST or so to speak bilinear sampler along with…
0
votes
0 answers

How to resample a 2-D spatial matrix (not a time series) using a weighted average to from the 1km grid to the 0.25 degree

I have a bumpy matrix A with shape [num_X, num_Y]. The corresponding lattitude and longitude array is A_lat (of size [num_Y,1]) and A_lon (of size [num_X,1]). And the each element of this matrix for example A[i, j] represents a value of geophysical…
0
votes
1 answer

How do I get the complexity of bilinear/nearest neighbour interpolation algorithm? (calculate the big O)

I want to calculate the big O of the following algorithms for resizing binary images: Bilinear interpolation: double scale_x = (double)new_height/(height-1); double scale_y = (double)new_width/(width-1); for (int i = 0; i <…
0
votes
0 answers

How can I use the akima package bilinear function for a 1 row matrix for the interpolation?

I am using the akima::bilinear function and it is generally working great. However, for some use cases, the interpolation grid is only 1 row but multiple columns. I know I could have an if statement and use use the approx() function instead but the…
scopes
  • 1
  • 1
0
votes
0 answers

How does extrapolation for spline in Matlabs interp2 works?

I know there has already been a lot of questioning about spline extrapolation in Matlab. I have an example where this works great in 2D and I want to understand this behaviour to programm it in C# using Math.Net. Here is my example: matrix =…
Till
  • 183
  • 7
0
votes
1 answer

Finding nearest points in a scattered data

I am struggling with improving the speed of interpolation of a large dataset which I am interpolating using gridfit. I have already posted a question on stackoverflow but havent got a response So, I am thinking of trying something alternate. My idea…
0
votes
1 answer

Bilinear Interpolation from wikipedia

I've tried reading the bilinear interpolation on the Wikipedia page https://en.wikipedia.org/wiki/Bilinear_interpolation and I have implemented one of the algorithms and I wanted to know if I'm doing it right or not. This is the algorithm I…
Josh
  • 63
  • 1
  • 10
0
votes
0 answers

Integer Bilinear interpolation optimization

My code was very much bottlenecked by bilinear interpolation so I wrote a version (ScaleBlerpI) that does not use floating point math. This is already 1.5 1.85 times faster but I am wondering how I could make it even faster. Any hints are…
Wendelin
  • 2,354
  • 1
  • 11
  • 28
0
votes
1 answer

How to implement 3D bilinear interpolation using numpy?

I have reached to this bilinear interpolation code (added here), but I would like to improve this code to 3D, meaning update it to work with an RGB image (3D, instead of only 2D). If you have any suggestions of how I can to that I would love to…
0
votes
1 answer

How to regrid a netCDF file using bilinear interpolation in r

I am trying to regrid a Netcdf file using a specified list of longitude and latitudes. I want to use bilinear interpolation and although I have seen that CDO and NCO are helpful I want to implement this in r. I have seen that there is an akima…
j.doe
  • 35
  • 5