how to draw interpolation
Answers
Answer:
Let us say that we have two known points x1,y1 and x2,y2.
Now we want to estimate what y value we would get for some x value that is between x1 and x2. Call this y value estimate — an interpolated value.
Two simple methods for choosing y come to mind. The first is see whether x is closer to x1 or to x2. If x is closer to x1 then we use y1 as the estimate, otherwise we use y2. This is called nearest neighbor interpolation.
The second is to draw a straight line between x1,y1 and x2,y2. We look to see the y value on the line for our chosen x. This is linear interpolation.
It is possible to show that the formula of the line between x1,y1 and x2,y2 is:
y=y1+(x−x1)y2−y1x2−x1
(png, hires.png, pdf)
_images/linear_interpolation-1.png
Answer:
hope this will help u
Explanation:
import Image
import ImageDraw
im = Image.new('RGB',(500,500),(255,255,255))
draw = ImageDraw.Draw(im)
draw.line(points, fill=(255,0,0))
del draw
im.save('output.jpg')