0

I am currently creating an image by interpolation a set of points (my_data) and then accessing the interpolated pixel data by opening the image created:

from matplotlib import pyplot as plt
import numpy as np
import matplotlib.image as mpimg

fig = plt.figure(frameon=False)
fig.set_size_inches(5, 3)
plt.axis('off')
plt.imshow(my_data, interpolation='bilinear',origin='lower')
plt.savefig("my_image.png", dpi=1000, bbox_inches='tight', pad_inches=0, frameon=None)
img_data = mpimg.imread('my_image.png')

I want to access img_data without having to 'physically' create an image and then open said image. Any idea on how to do this?

EliseB
  • 639
  • 1
  • 9
  • 15
  • 1
    So what you're asking is how you could create or use a module that does bilinear interpolation in Python. https://stackoverflow.com/questions/8661537/how-to-perform-bilinear-interpolation-in-python. Scipy's interp2d might also be a good place to look: https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.interp2d.html – BoboDarph Nov 17 '17 at 11:53

1 Answers1

0

You could just use scipy.interpolate, instead of relying on matplolib.

VBB
  • 1,305
  • 7
  • 17