Questions tagged [linear-interpolation]

Linear interpolation is the process of approximating intermediate values given an assumption that the ranges of missing data look roughly like straight lines.

Linear interpolation is largely used for its simplicity and is typically more effective given a greater density of data. The more complex the underlying relationship of the quantities involved, the less likely linear interpolation is to provide a good value estimates.

In scientific software for statistical computing and graphics, function approx performs 1D linear interpolation.

437 questions
3
votes
3 answers

Pandas dataframe: Fill in interpolated date values per category

I'm working in Python 3 with a Pandas DataFrame. It has columns for Category, Date and Value. For each category, I want to add rows with the missing days, such the value is linearly interpolated. To create the minimal example, I use the following…
3
votes
0 answers

Image downsampling and upsampling using bilinear interpolation

I am trying to understand how exactly the upsampling and downsampling of a 2D image I have, would happen using Bilinear interpolation. Now I am aware of how bilinear interpolation works using a 2x2 neighbourhood values to interpolate the data point…
goldenmean
  • 18,376
  • 54
  • 154
  • 211
3
votes
1 answer

Change the melody of human speech using FFT and polynomial interpolation

I'm trying to do the following: Extract the melody of me asking a question (word "Hey?" recorded to wav) so I get a melody pattern that I can apply to any other recorded/synthesized speech (basically how F0 changes in time). Use polynomial…
3
votes
1 answer

Linear interpolation between rows in pandas DataFrame

I have the following DataFrame: import numpy as np import pandas as pd df = pd.DataFrame([np.zeros(10), np.arange(1,11), np.arange(11,21), np.arange(21,31)]) I'm looking for a way to do efficient linear…
jtm_beta
  • 145
  • 8
3
votes
2 answers

How to properly blend colors across two triangles and remove diagonal smear

I am learning WebGL and I've drawn a full screen quad with colors for each vertex. No lighting or normals or perspective matrix or depth buffer; I'm just drawing a gradient background. This is what I get: It looks good but I cannot help noticing…
whiterook6
  • 3,270
  • 3
  • 34
  • 77
3
votes
1 answer

Linear interpolate where data is invalid

I would like to linearly interpolate a single column based on previous and next know values only where data is equal to "---". Data example: 0 --- --- --- 10 --- 20 22 15 --- --- --- -15 Wanted output: 0 2.5 5 7.5 10 15 20 22 15 7.5 0 -7.5 -15 I…
3
votes
1 answer

gdal_grid linear producing odd results

I Have a large Point shapefile (xyz, about 65,000 points) from a LiDAR las file and am trying to interpolate this onto a grid using gdal_grid: gdal_grid -ot Float64 -txe 422306.5970 422343.9970 -tye 4037022.9899 4036967.3399…
user2611761
  • 169
  • 1
  • 1
  • 11
3
votes
3 answers

Filling cell values horizontally in Pandas dataframe

I know about bfill and ffill to fill values in rows of the same column. But how do you do it when you need to fill values across certain multiple columns in a dataframe? Here's the example: Initial df: import pandas as pd inidf = [('Prod', ['P1',…
Jdoe
  • 111
  • 2
  • 10
3
votes
1 answer

Multiplayer browser game: linear interpolation causing jittering and jumping

I'm developing a browser multiplayer game, in which each client interpolates (linear) the frames of entities sent by the server. It doesn't look too bad at a high framerate (> 30fps), but starts to jitter at lower framerates (< 30fps) and freezes…
Luke
  • 2,038
  • 3
  • 22
  • 46
3
votes
1 answer

imresize bilinear MATLAB

I try to resize an image with MATLAB and there was something strange to understand directly about imresize function with bilinear mode. I will give you examples to make sure what's the problem. Say, the followings are 1D-matrix. A: [0 1 2] B: [1 2 0…
Mark Yoon
  • 330
  • 4
  • 17
3
votes
1 answer

Can scipy's RegularGridInterpolator return both values and gradients with a single call?

I'm using scipy.interpolate.RegularGridInterpolator with method='linear'. Getting interpolated values is straightforward (see example at https://docs.scipy.org/doc/scipy-0.16.0/reference/generated/scipy.interpolate.RegularGridInterpolator.html). …
Adrian
  • 3,138
  • 2
  • 28
  • 39
3
votes
4 answers

Randomly generated sorted arrays: search performances comparison

I'm making a program that tests and compares stats of Multi-Key Sequential search and Interpolation binary search. I'm asking for an advice: What is the best way to sort a random-generated array of integers, or even generate it like a sorted one…
Stefan Stanković
  • 628
  • 2
  • 6
  • 17
3
votes
1 answer

How to Create a Duotone Interpolation Color in GDI+ (.NET)?

I have two colors that I need to linearly interpolate to create a duotone color based of another color's luminance value. Dim clr1 = Color.Black Dim clr2 = Color.FromArgb(224, 255, 165) Dim lum = Color.FromArgb(226, 189, 136).GetBrightness 'lum =…
Todd Main
  • 28,951
  • 11
  • 82
  • 146
3
votes
1 answer

Interpolating missing values in Python

All - I hope you'll be able to help as it's one of those tasks where I know I've almost cracked from the various postings on here and online, but haven't quite got it to work. Essentially, I have the following data in a database that is returned to…
Patrick A
  • 277
  • 1
  • 3
  • 12
3
votes
3 answers

Python Pandas Linear Interpolate Y over X

I'm trying to answer this Udacity question: https://www.udacity.com/course/viewer#!/c-st101/l-48696651/e-48532778/m-48635592 I like Python & Pandas so I'm using Pandas (version 0.14) I have this DataFrame df= pd.DataFrame(dict(size=(1400, …
Nate Anderson
  • 18,334
  • 18
  • 100
  • 135