image_demo2.py

来自「非原创。很好的python例子」· Python 代码 · 共 36 行

PY
36
字号
#!/usr/bin/env pythonfrom pylab import *w, h = 512, 512s = file('data/ct.raw', 'rb').read()A = fromstring(s, UInt16).astype(Float)A *= 1.0/max(A)A.shape = w, hextent = (0, 25, 0, 25)im = imshow(A, cmap=cm.jet, origin='upper', extent=extent)# plot some data with the image; currently broken with aspect preservemarkers = [(15.9, 14.5), (16.8, 15)]x,y = zip(*markers)plot(x, y, 'o')#axis([0,25,0,25])#axis('off')title('CT density')if 0:    x = asum(A,0)    subplot(212)    bar(arange(w), x)    xlim(0,h-1)    ylabel('density')    setp(gca(), 'xticklabels', [])#savefig('image_demo2')show()

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?