interpolation

Texture mapping in MATLAB

I have points in 3D space and their corresponding 2D image points. How can I make a mesh out of the 3D points, then texture the triangle faces formed by the mesh? Update See answer ...

Interpolating Large Datasets On the Fly

Interpolating Large Datasets I have a large data set of about 0.5million records representing the exchange rate between the USD / GBP over the course of a given day. I have an application that wants to be able to graph this data or maybe a subset. For obvious reasons I do not want to plot 0.5 million points on my graph. What I need i...

1D Function into 2D Function Interpolation

Hello. I have a 1D function which I want to interpolate into 2D function. I know the function should have "Polar Symmetry". Hence I use the following code (Matlab Syntax): Assuming the 1D function is LSF of the length 15. [x, y] = meshgrid([-7:7]); r = sqrt(x.^2 + y.^2); PSF = interp1([-7:7], LSF, r(:)); % Sometimes using 'spline' optio...

How to interpolate hue values in HSV colour space?

Hi, I'm trying to interpolate between two colours in HSV colour space to produce a smooth colour gradient. I'm using a linear interpolation, eg: h = (1 - p) * h1 + p * h2 s = (1 - p) * s1 + p * s2 v = (1 - p) * v1 + p * v2 (where p is the percentage, and h1, h2, s1, s2, v1, v2 are the hue, saturation and value components of the two ...

What's the most effective way to interpolate between two colors? (pseudocode and bitwise ops expected)

Making a Blackberry app, want a Gradient class. What's the most effective way (as in, speed and battery life) to interpolate two colors? Please be specific. // Java, of course int c1 = 0xFFAA0055 // color 1, ARGB int c2 = 0xFF00CCFF // color 2, ARGB float st = 0 // the current step in the interpolation, between 0 and 1 He...

Can a freemarker interpolation contain an interpolation?

Let's say I have Freemarker variable A that contains the name of another variable on the hash tree, say. "B." I'd like to use a to read the value of B so, for example, if B contained "C" I could tell Freemarker to output C using A: ${${A}} should result in the output of "C". Naturally, this doesn't work in Freemarker, but is there a way ...

OpenGL Color Interpolation across vertices

Right now, I have more than 25 vertices that form a model. I want to interpolate color linearly between the first and last vertex. The Problem is when I write the following code glColor3f(1.0,0.0,0.0); vertex3f(1.0,1.0,1.0); vertex3f(0.9,1.0,1.0); . .`<more vertices>; glColor3f(0.0,0.0,1.0); vertex3f(0.0,0.0,0.0); All the vertices exc...

Is there a Java data structure that is effectively an ArrayList with double indicies and built-in interpolation?

I am looking for a pre-built Java data structure with the following characteristics: It should look something like an ArrayList but should allow indexing via double-precision rather than integers. Note that this means that it's likely that you'll see indicies that don't line up with the original data points (i.e., asking for the value...

How to get a flat, non-interpolated color when using vertex shaders.

Hi, Is there a way to achieve this (OpenGL 2.1)? If I draw lines like this glShadeModel(GL_FLAT); glBegin(GL_LINES); glColor3f(1.0, 1.0, 0.0); glVertex3fv(bottomLeft); glVertex3fv(topRight); glColor3f(1.0, 0.0, 0.0); glVertex3fv(topRight); glVertex3fv(topLeft); . . (draw a square) . . glEnd(); I get the desired...

Rotation Interpolation

Hello, NB: I'll present this question in degrees purely for simplicity, radians, degrees, different zero-bearing, the problem is essentially the same. Does anyone have any ideas on the code behind rotational interpolation? Given a linear interpolation function: Lerp(from, to, amount), where amount is 0...1 which returns a value between ...

Speed of interpolation algorithms, C# and C++ working together.

Hello. I need fast implementation of popular interpolation algorithms. I figured it out that C# in such simple algorithms will be much slower than C++ so i think of writing some native code and using it in my C# GUI. First of all i run some tests and few operations on 1024x1024x3 matrix took 32ms in C# and 4ms in C++ and that's what i ...

How to make a simple grafical interface in C# for DCRAW

Hello, i have a problem. I need to make a simple GUI in Visual Studio 2008 using C Sharp that uses a Dave Coffins DCRAW written in C but I don't know how to "connect" dcraw.c (DCRAW source code) file with Csharp... UFRAW is the example of grafical interface that uses dcraw but I can't find it's source code. My application should be very ...

How can I match end-of-line multiple times in a regex without interpolation?

Hi, if I have a input with new lines in it like: [INFO] xyz [INFO] How can I pull out the xyz part using $ anchors? I tried a pattern like /^\[INFO\]$(.*?)$\[INFO\]/ms, but perl gives me: Use of uninitialized value $\ in regexp compilation at scripts\t.pl line 6. Is there a way to shut off interpolation so the anchors work as expe...

Flipping issue when interpolating Rotations using Quaternions

I use slerp to interpolate between two quaternions representing rotations. The resulting rotation is then extracted as Euler angles to be fed into a graphics lib. This kind of works, but I have the following problem; when rotating around two (one works just fine) axes in the direction of the green arrow as shown in the left frame here ...

Interpolation and Morphing of an image in labview and/or openCV

I am working on an image manipulation problem. I have an overhead projector that projects onto a screen, and I have a camera that takes pictures of that. I can establish a 1:1 correspondence between a subset of projector coordinates and a subset of camera pixels by projecting dots on the screen and finding the centers of mass of the re...

Interpolation of scattered data: What could I do?

Hi! I need your help. I'm working on a 3D chart in Java using Java 3D. It should be able to display a bunch of measured values. As measured, the data I get is scattered. This means I will have to interpolate the missing points in order to get my surface plotted nicely. I didn't study all that 3D-Geometry stuff yet and I don't know wh...

Trying to reference a hash using a string value in Ruby

How would I refer to a hash using the value of a string - i.e. #!/usr/bin/env ruby foo = Hash.new bar = "foo" "#{bar}"["key"] = "value" results in foo:5:in `[]=': string not matched (IndexError) from foo:5 How do I use the value of bar (foo) to reference the hash named foo? Thanks! ...

implementation of interp1 function of MATLAB in J2ME

Hi, i am looking to implement the interp1, 1-D data interpolation (table lookup), function available in MATLAB in J2ME or JAVA. here is the link http://www.mathworks.com/access/helpdesk/help/techdoc/ref/interp1.html Is there any library available in J2ME or JAVA which has already implemented the same function ? If not can anybody help...

Polymorphic Paperclip Interpolations

I'm using the Polymorphic fork of Paperclip in Rails, but have been having some massive problems with regards to the overwriting of unique filenames. No matter whether I put a time-stamp (more on that in a second) or the id of the asset in the URL, if a file with the same name is uploaded subsequently, then the previous one is overwritte...

extracting a quadrilateral image to a rectangle

BOUNTY UPDATE Following Denis's link, this is how to use the threeblindmiceandamonkey code: // the destination rect is our 'in' quad int dw = 300, dh = 250; double in[4][4] = {{0,0},{dw,0},{dw,dh},{0,dh}}; // the quad in the source image is our 'out' double out[4][5] = {{171,72},{331,93},{333,188},{177,210}}; double homo[3][6]; c...