def bsm(n): a = [[0]*n for x in range(n)] p = 0 q = n-1 t = 1 while p < q: for i in range(p,q): a[p][i] = t t += 1 for i in range(p,q): a[i][q] = t t += 1 for i in range(q,p,-1): a[q][i] = t t += 1 for i in range(q,p,-1): a[i][p] = t t += 1 p += 1 q…
代码: #!/usr/bin/env python # encoding: utf-8 """ @author: 侠之大者kamil @file: 2.回形矩阵.py @time: 2016/3/21 10:51 """ def sankeMatric(n): m = [[0] * n for x in range(n)] p = 0 q = n-1 t = 1 while p < q: for i in range(p,q): m[p][…
img = np.zeros((112,112,3))#cv2.imread('F:/project/Breast/InBreast/INBreast/outimgpatch/allnocalcification/20586908_1.png') for i in range(112): for j in range(112): for k in range(3): img[i,j,k] = 0 plt.imshow(img) plt.show() cv2.imwrite(tarDir + '1…