python实现终端3维数据可视化

python实现终端3维数据可视化

python实现终端3维数据可视化

python实现终端3维数据可视化

用matplotlib制作图表

把文件当做变量拿来和opencv互相通信

用opencv解析图像

# -*- coding:utf-8 -*- from HUAI_ZH import * from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib.pyplot as plt import show import cv2 import os from matplotlib import pyplot as plt import numpy as np from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = Axes3D(fig) X = np.arange(-4, 4, 0.25) Y = np.arange(-4, 4, 0.25) X, Y = np.meshgrid(X, Y) R = np.sqrt(X**2 + Y**2) Z = np.sin(R) a=ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=\'rainbow\') x=45 y=45 for i in range(100): p=raw_input(\'请输入方向\') if p==\'w\':y=y+10 if p==\'s\':y=y-10 if p==\'a\':x=x-10 if p==\'d\':x=x+10 ax.view_init(x,y) plt.savefig(\'/sdcard/qpython/qpyim.jpg\',dpi=500) pic = cv2.imread(\'/sdcard/qpython/qpyim.jpg\',0) pic = cv2.resize(pic, (int(95*2.8), int(95*2)), interpolation=cv2.INTER_CUBIC) ret,th1 = cv2.threshold(pic,140,255,cv2.THRESH_BINARY) os.system(\'clear\') print(\'\033[1;91m\') for i in th1: l=i.tolist() l=[str(i) for i in l] s=\'\'.join(l).replace(\'255\',\'\033[1;96m\'+\' \'+\'\033[1;91m\').replace(\'0\',\'*\') print(s)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzpywp.html