Get graph data from a JPEG or PNG file

I am writing a program that receives graph data from a graph (JPEG). The vertical axis is logarithmic. I successfully made a program that understands the horizontal and vertical axes as linear (not logarithmic), see the code below:

enter image description here

%matplotlib inline from PIL import Image from scipy import * from pylab import * im = array(Image.open('fig1.jpg')) hh = im.shape[0] ww = im.shape[2] imshow(im) print(im[100,0,:]) Col = array([255,0,0])#赤 bnd = 30 yax = linspace(0.5,2e-4,hh) xax = linspace(1,14,ww) for i in range(hh): for j in range(ww): im[i,j,:] = 255*(any(im[i,j,:]>Col+bnd) or any(im[i,j,:]<Col-bnd)) mapim = abs(im[:,:,0]/255-1).astype(bool) yval = array([average(yax[mapim[:,t]]) for t in range(ww)]) rlt = interp(range(100),xax,yval) 

I do not know how to change it in order to understand the logarithmic axis. Please help me.

+6
source share

All Articles