First on:
NOTE: Reprint please indicate the source
Making charts with Matplotlib
Take the file as a variable and communicate with the OPENCV.
Parsing images with OpenCV
#-*-Coding:utf-8-*-from huai_zh import *from Mpl_toolkits.mplot3d import axes3dimport numpy as Npimport MATPLOTLIB.PYPL OT as Pltimport showimport cv2import osfrom matplotlib import pyplot as Pltimport numpy as Npfrom Mpl_toolkits.mplot3d Imp Ort axes3dfig = 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=45y=45for I in range ( : P=raw_input (' Please input direction ') 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-th1:l=i.tolist () l=[str (i) for I I N l] s= '.Join (L). Replace (' 255 ', ' \033[1;96m ' + ' + ' \033[1;91m '). Replace (' 0 ', ' * ') print (s)
How to Eat:
First, set the Qpython character size to the lowest
Then run the program
Dependent libraries are:
OpenCV
Matplotlib
Installation commands
Pip Install Opencvpip Install Matplotlib
NOTE: Reprint please indicate the source!!
Python for Endpoint 3-D data visualization