摘要: a=[1,2,5,9,7,3]a=np.array(a)order = a.argsort() # 从小到大排序,并返回索引值print('order=',order)order1= a.argsort()[::-1] # 从大到小排序,并返回索引值 print('order1=',order1) 阅读全文
posted @ 2019-08-21 08:43 tangjunjun 阅读(977) 评论(0) 推荐(0) 编辑
摘要: import osdir_list = os.listdir('C:\\Users\\10107472\\Desktop\\practice\\JPEGImages')i=0f1=open('C:\\Users\\10107472\\Desktop\\practice\\train1.txt','r 阅读全文
posted @ 2019-08-08 15:04 tangjunjun 阅读(456) 评论(0) 推荐(0) 编辑
摘要: a=np.array([1,2,3,4])a=a[np.newaxis,:] #固定行,相当于1行多列b=np.array([2,4,6]) b=b[:,np.newaxis] #固定列,相当与多行1列print(a)print(b)c=a/b #将会产生三行四列print(c) 阅读全文
posted @ 2019-08-06 11:51 tangjunjun 阅读(275) 评论(0) 推荐(0) 编辑
摘要: import osdef list_dir(file_dir): f=open('C:\\Users\\10107472\\Desktop\ok.txt','w') #打开文件 ''' 通过 listdir 得到的是仅当前路径下的文件名,不包括子目录中的文件,如果需要得到所有文件需要递归 ''' # 阅读全文
posted @ 2019-08-02 17:05 tangjunjun 阅读(284) 评论(0) 推荐(0) 编辑
摘要: import numpy as npa=np.array([[11,12,13,14,15,16,17,18],[21,22,23,24,25,26,27,28],[31,32,33,34,35,36,37,38],[41,42,43,44,45,46,47,48]])print(a)b=a[:,::-1] #表示从最后一列开始,每隔1列就取,相当于倒叙print(b) b1=a[:,::-... 阅读全文
posted @ 2019-08-02 09:28 tangjunjun 阅读(662) 评论(0) 推荐(0) 编辑
摘要: class Fab(object): def __init__(self ,max ): self.max =max self.n =0 self.a=0 self.b =1 def __iter__(self): #迭代器,表示为容器,相当于声明 return self def __next__( 阅读全文
posted @ 2019-07-30 13:26 tangjunjun 阅读(449) 评论(0) 推荐(0) 编辑
摘要: m21文件代码 m22文件代码 阅读全文
posted @ 2019-07-28 22:22 tangjunjun 阅读(1533) 评论(0) 推荐(0) 编辑
摘要: import cv2 as cvimport numpy as npimg=cv.imread('learn.jpg',cv.IMREAD_GRAYSCALE)cv.imshow('first image',img)img_size=img.shapeprint(img_size)imgkernel=np.array([[-2,-1,0], [-1, 1,1]... 阅读全文
posted @ 2019-07-25 11:57 tangjunjun 阅读(2182) 评论(0) 推荐(0) 编辑
摘要: import matplotlib.pyplot as pltimport cv2 as cva=cv.imread('learn.jpg')cv.imshow('learn',a)fig=plt.figure(1) #新建绘图窗口b=fig.add_subplot(221) #选择画布第一个b.imshow(a,cmap=plt.cm.gray) #读图cv.imshow('lear... 阅读全文
posted @ 2019-07-23 09:49 tangjunjun 阅读(1849) 评论(0) 推荐(1) 编辑
摘要: import numpy as npimport osa=bytearray(os.urandom(27))# for i in range(21):# print(a[i])a=np.array(a)print(a)b=a.reshape((-1,3))print(b)c=bytearray(b)print(c)for i in range(27): print(a[i]) ... 阅读全文
posted @ 2019-07-22 16:23 tangjunjun 阅读(513) 评论(0) 推荐(0) 编辑
https://rpc.cnblogs.com/metaweblog/tangjunjun