此代码从图像小波打印出无穷无尽的数字列到控制台。我需要将输出限制为前 50 或 100 个项目。我试图做到这一点,但无法得到我需要的东西。
def waveletdbbiorone(self): #function for Wavelets computation
for filename in glob.iglob ('*.tif'):
imgwbior = mahotas.imread (filename) #read the image
arraywbior = numpy.array([imgwbior])#make an array
coefwbior = pywt.wavedec(arraywbior,'db1')#compute wavelet coefficients
arr = numpy.array([coefwbior])
np.set_printoptions(threshold=3)
# print arr
for elem in arr.flat:
print('{}\t'.format(elem)) #, end ='') #print out the result