interpolation

remove the holes in an image by average values of surrounding pixels

£可爱£侵袭症+ 提交于 2019-12-03 12:39:15
can any one please help me in filling these black holes by values taken from neighboring non-zero pixels. thanks There is a file on Matlab file exchange, - inpaint_nans that does exactly what you want. The author explains why and in which cases it is better than Delaunay triangulation. One nice way to do this is to is to solve the linear heat equation . What you do is fix the "temperature" (intensity) of the pixels in the good area and let the heat flow into the bad pixels. A passable, but somewhat slow, was to do this is repeatedly average the image then set the good pixels back to their

Rails 3, Paperclip - Custom Interpolations

二次信任 提交于 2019-12-03 12:02:04
I've been having some troubles making custom Interpolation, gone through every example I could find on web, but no matter what I did, had no success. At the moment I have this: Model has_attached_file :photo, :path => ":rails_root/public/images/:img_name-:style.:extension", :styles => { :original => '100x100', :thumb => '30x30' } initializers/paperclip.rb Paperclip.interpolates :img_name do |attachment, style| attachment.instance.img_name end img_name is field populated in form on upload with the image. The error I get on upload is: Invalid argument - (C:/Users/.../stream20110410-384

Python pandas time series interpolation and regularization

故事扮演 提交于 2019-12-03 08:52:21
问题 I am using Python Pandas for the first time. I have 5-min lag traffic data in csv format: ... 2015-01-04 08:29:05,271238 2015-01-04 08:34:05,329285 2015-01-04 08:39:05,-1 2015-01-04 08:44:05,260260 2015-01-04 08:49:05,263711 ... There are several issues: for some timestamps there's missing data (-1) missing entries (also 2/3 consecutive hours) the frequency of the observations is not exactly 5 minutes, but actually loses some seconds once in a while I would like to obtain a regular time

How to create multiple stop gradient fragment shader?

◇◆丶佛笑我妖孽 提交于 2019-12-03 07:19:42
I'm trying to create an OpenGL ES 2.0 fragment shader that outputs multiple stop gradient along one axis. It should interpolate between multiple colors at points defined in percents. I've achieved this by using if s the fragment shader, like this: float y = gl_FragCoord.y; float step1 = resolution.y * 0.20; float step2 = resolution.y * 0.50; if (y < step1) { color = white; } else if (y < step2) { float x = smoothstep(step1, step2, y); color = mix(white, red, x); } else { float x = smoothstep(step2, resolution.y, y); color = mix(red, green, x); } They say that branching in fragment shader can

Java 2D weighted data interpolation

假如想象 提交于 2019-12-03 07:08:20
问题 I'm trying to find some Java lib, code example (or a starting point) to help me figure out how can I interpolate a list of 2d points with a weight to generate a interpolation with level curves. Googling I figure out that there is several algorithms available to do this, and i found some explanations with interesting content. The first algorithm that I want to try is the Inverse Distance Weighted interpolation. But with all this information i have some basic doubts: To generate one picture

Fast linear interpolation in Numpy / Scipy “along a path”

不打扰是莪最后的温柔 提交于 2019-12-03 06:53:34
问题 Let's say that I have data from weather stations at 3 (known) altitudes on a mountain. Specifically, each station records a temperature measurement at its location every minute. I have two kinds of interpolation I'd like to perform. And I'd like to be able to perform each quickly. So let's set up some data: import numpy as np from scipy.interpolate import interp1d import pandas as pd import seaborn as sns np.random.seed(0) N, sigma = 1000., 5 basetemps = 70 + (np.random.randn(N) * sigma)

scipy: Interpolating trajectory

混江龙づ霸主 提交于 2019-12-03 06:13:29
I have a trajectory formed by a sequence of (x,y) pairs. I would like to interpolate points on this trajectory using splines. How do I do this? Using scipy.interpolate.UnivariateSpline doesn't work because neither x nor y are monotonic. I could introduce a parametrization (e.g. length d along the trajectory), but then I have two dependent variables x(d) and y(d) . Example: import numpy as np import matplotlib.pyplot as plt import math error = 0.1 x0 = 1 y0 = 1 r0 = 0.5 alpha = np.linspace(0, 2*math.pi, 40, endpoint=False) r = r0 + error * np.random.random(len(alpha)) x = x0 + r * np.cos(alpha)

Image interpolation mode in Chrome/Safari?

谁说胖子不能爱 提交于 2019-12-03 04:52:55
I need to have an image render with nearest-neighbor resizing and not the bicubic way that is currently used. I currently use the following: ms-interpolation-mode: nearest-neighbor; image-rendering: -moz-crisp-edges; This works in IE and Firefox, but not in Chrome and Safari. Are there any webkit alternatives or any other way to achieve this effect? thirtydot Edit: It's now possible with image-rendering: -webkit-optimize-contrast; . https://developer.mozilla.org/en-US/docs/CSS/image-rendering#Examples This doesn't work in current versions of Chrome, here are some useful links: http:/

Interpolating data points in Excel

和自甴很熟 提交于 2019-12-03 04:19:17
问题 I'm sure this is the kind of problem other have solved many times before. A group of people are going to do measurements (Home energy usage to be exact). All of them will do that at different times and in different intervals. So what I'll get from each person is a set of {date, value} pairs where there are dates missing in the set. What I need is a complete set of {date, value} pairs where for each date withing the range a value is known (either measured or calculated). I expect that a simple

R - Smoothing color and adding a legend to a scatterplot

好久不见. 提交于 2019-12-03 03:54:48
I have a scatterplot in R. Each (x,y) point is colored according to its z value. So you can think of each point as (x,y,z) , where (x,y) determines its position and z determines its color along a color gradient. I would like to add two things A legend on the right side showing the color gradient and what z values correspond to what colors I would like to smooth all the color using some type of interpolation, I assume. In other words, the entire plotting region (or at least most of it) should become colored so that it looks like a huge heatmap instead of a scatterplot. So, in the example below,