1

Python ウェーブレット パッケージからの出力があります。

 [[[[[[255 255 255 255]
 [255 255 255 255]
 [255 255 255 255]
 ..., 
 [255 255 255 255]
 [255 255 255 255]
 [255 255 255 255]]

[[255 255 255 255]
 [255 255 255 255]
 [255 255 255 255]
 ..., 
 [255 255 255 255]
 [255 255 255 255]
 [255 255 255 255]]

[[255 255 255 255]
 [255 255 255 255]
 [255 255 255 255]
 ..., 
 [255 255 255 255]
 [255 255 255 255]
 [255 255 255 255]]

..., 
[[255 255 255 255]
 [255 255 255 255]
 [255 255 255 255]
 ..., 
 [255 255 255 255]
 [255 255 255 255]
 [255 255 255 255]]

[[255 255 255 255]
 [255 255 255 255]
 [255 255 255 255]
 ..., 
 [255 255 255 255]
 [255 255 255 255]
 [255 255 255 255]]

[[255 255 255 255]
 [255 255 255 255]
 [255 255 255 255]
 ..., 
 [255 255 255 255]
 [255 255 255 255]
 [255 255 255 255]]]]]]

.csvタブ区切りで括弧なしで1行で端末とファイルに出力する必要があります。

 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 for pywt module
         coefwbior = pywt.wavedec(arraywbior,'db1')#compute wavelet coefficients
         arr = numpy.array([coefwbior])
         np.set_printoptions(precision=3)
         print arr
4

1 に答える 1

0

本当に 1 行だけが必要な場合は、 iterator を使用しますflat

パイソン3

>>> for elem in arr.flat:
        print('{}\t'.format(elem), end='')  
    255.0   255.0   255.0   255.0   255.0 .........

パイソン 2

>>> for elem in arr.flat:
        print '{}\t'.format(elem),
    255.0   255.0   255.0   255.0   255.0 .........
于 2013-06-06T09:41:48.170 に答える