interpolation

How can you produce sharp paint results when rotating a BufferedImage?

不打扰是莪最后的温柔 提交于 2019-11-30 01:38:35
One attempted approach was to use TexturePaint and g.fillRect() to paint the image. This however requires you to create a new TexturePaint and Rectangle2D object each time you paint an image, which isn't ideal - and doesn't help anyway. When I use g.drawImage(BufferedImage,...) , the rotated images appear to be blurred/soft. I'm familiar with RenderingHints and double-buffering (which is what I'm doing, I think), I just find it difficult to believe that you can't easily and efficiently rotate an image in Java that produces sharp results. Code for using TexturePaint looks something like this.

Matplotlib contour from xyz data: griddata invalid index

僤鯓⒐⒋嵵緔 提交于 2019-11-30 00:56:02
I'm trying to do a contour plot using matplotlib of a file with the following format: x1 y1 z1 x2 y2 z2 etc I can load it with numpy.loadtxt to get the vectors. So far, no trouble. I read this to learn how to plot, and can reproduce it by copy paste, so i'm sure nothin is wrong with my installation: http://matplotlib.org/examples/pylab_examples/griddata_demo.html I understand I have to input x and y as vector and z as an array ,which can be done with griddata. This is also what i find on this site. The documentation says: zi = griddata(x,y,z,xi,yi) fits a surface of the form z = f*(*x, y) to

How can I get the output of a matplotlib plot as an SVG?

て烟熏妆下的殇ゞ 提交于 2019-11-29 22:41:46
I need to take the output of a matplotlib plot and turn it into an SVG path that I can use on a laser cutter. import matplotlib.pyplot as plt import numpy as np x = np.arange(0,100,0.00001) y = x*np.sin(2*pi*x) plt.plot(y) plt.show() For example, below you see a waveform. I would like to be able to output or save this waveform as an SVG path that I can later work with in a program such as Adobe Illustrator. I am aware of an SVG library called "Cairo" that matplotlib can use ( matplotlib.use('Cairo') ), however it's not clear to me that this will give me access to the SVG path that I need, even

fastest way to use numpy.interp on a 2-D array

不想你离开。 提交于 2019-11-29 21:52:45
问题 I have the following problem. I am trying to find the fastest way to use the interpolation method of numpy on a 2-D array of x-coordinates. import numpy as np xp = [0.0, 0.25, 0.5, 0.75, 1.0] np.random.seed(100) x = np.random.rand(10) fp = np.random.rand(10, 5) So basically, xp would be the x-coordinates of the data points, x would be an array containing the x-coordinates of the values I want to interpolate, and fp would be a 2-D array containing y-coordinates of the datapoints. xp [0.0, 0.25

What is the best drop-in replacement for numpy.interp if I want the null interpolation (piecewise constant)?

拥有回忆 提交于 2019-11-29 20:57:47
问题 numpy.interp is very convenient and relatively fast. In certain contexts I'd like to compare its output against a non-interpolated variant where the sparse values are propagated (in the "denser" output) and the result is piecewise constant between the sparse inputs. The function I want could also be called a "sparse -> dense" converter that copies the latest sparse value until it finds a later value (a kind of null interpolation as if zero time/distance has ever elapsed from the earlier value

Interpolation over regular grid in Python [closed]

一个人想着一个人 提交于 2019-11-29 19:54:39
I have been struggling to inteprolate the data for "empty" pixels in my 2D matrix. Basically, I understand (but not deeply) interpolation techniques such as Inverse Distance Weighting, Kriging, Bicubic etc. I dont know the starting point exactly (either in the statement of the problem or Python case). The problem definition: I have MxN matrix (regular grid) in which each pixel represents certain measurement value ( figure below and data used in this figure is here ). I wanted to interpolate the data for "question mark space" (white space which also consists of the same sized but empty pixels)

Texture mapping in MATLAB

那年仲夏 提交于 2019-11-29 18:56:52
问题 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? 回答1: Note that the function trisurf that you were originally trying to use returns a handle to a patch object. If you look at the 'FaceColor' property for patch objects, you can see that there is no 'texturemap' option. That option is only valid for the 'FaceColor' property of surface objects. You will therefore have to find a way

How can I escape meta-characters when I interpolate a variable in Perl's match operator?

夙愿已清 提交于 2019-11-29 17:38:58
问题 Suppose I have a file containing lines I'm trying to match against: foo quux bar In my code, I have another array: foo baz quux Let's say we iterate through the file, calling each element $word , and the internal list we are checking against, @arr . if( grep {$_ =~ m/^$word$/i} @arr) This works correctly, but in the somewhat possible case where we have an test case of fo. in the file, the . operates as a wildcard operator in the regex, and fo. then matches foo , which is not acceptable. This

Intuitive interpolation between unevenly spaced points

倾然丶 夕夏残阳落幕 提交于 2019-11-29 15:52:16
问题 I have the following graph that I want to digitize to a high-quality publication grade figure using Python and Matplotlib: I used a digitizer program to grab a few samples from one of the 3 data sets: x_data = np.array([ 1, 1.2371, 1.6809, 2.89151, 5.13304, 9.23238, ]) y_data = np.array([ 0.0688824, 0.0490012, 0.0332843, 0.0235889, 0.0222304, 0.0245952, ]) I have already tried 3 different methods of fitting a curve through these data points. The first method being to draw a spline through the

How to project a line on a surfaceplot?

北城余情 提交于 2019-11-29 15:49:39
问题 I Have a surface plot created from point data stored in a CSV file. If I want to project a line (which is floating above the surface) on the surface created in 3D. What is the method? I have tried a code from the following post for projecting a line on xy-xz-yz plane. I can see that it is projecting the endpoint of line on the xy-xz-yz plane. If I want to project on the surface created with point data. I don't have an equation of the surface. I have created with point data available. Here is