def test():
import numpy as np;
import matplotlib.pyplot as plt;
import imageprocessing.smoothing as sth;
reload(sth);
data = np.random.rand(10,2);
img = sth.smooth_data(data, bounds = [(0,1),(0,1)], sigma = None, nbins = 100);
imgs = sth.smooth_data(data, bounds = [(0,1),(0,1)], sigma = 10, nbins = 100);
plt.figure(1); plt.clf();
plt.subplot(1,3,1);
plt.plot(data[:,1], data[:,0], '.');
plt.xlim(0,1); plt.ylim(0,1);
plt.gca().invert_yaxis()
plt.subplot(1,3,2);
plt.imshow(img);
plt.subplot(1,3,3);
plt.imshow(imgs);
x,y = img.nonzero()
print (x/100.0);
print np.sort(data[:,0])
curve = np.vstack([range(30,70), [90-i*1.5 for i in range(40)]]).T;
ic0 = sth.intensity_along_curve(imgs, curve);
#cc = curve.T;
#cc = cc[::-1];
#cc[1] = 100-cc[1];
#import scipy.ndimage as ndi
#ic = ndi.map_coordinates(imgs, cc);
plt.figure(2); plt.clf();
plt.subplot(1,2,1);
plt.imshow(imgs);
plt.plot(curve[:,0], curve[:,1], 'r');
#plt.plot(cc[0,:], cc[1,:])
plt.subplot(1,2,2);
plt.plot(ic0, 'r')
#plt.plot(ic)
评论列表
文章目录