Hi All,
i’ve data store in a multydimension numpy.array,
it is composed by 3 MxN normalized (0 - 1) array
but tring to display it using “imshow” i get an error,
" TypeError: Invalid dimensions for image data "
please can you help me to fix this problem ?
my data is :
In [119]: dd[0]
Out[119]:
array([[[ 1. , 1. , 1. , ..., 1. ,
1. , 1. ],
[ 1. , 1. , 1. , ..., 1. ,
1. , 1. ],
[ 1. , 1. , 1. , ..., 1. ,
1. , 1. ],
...,
[ 0.22834646, 0.39370079, 0.38976378, ..., 0.2519685 ,
0.25590551, 0.38582677],
[ 0.30708661, 0.25984252, 0.30314961, ..., 0.2480315 ,
0.25984252, 0.37401575],
[ 0.58661417, 0.62598425, 0.5984252 , ..., 0.2480315 ,
0.2519685 , 0.32283465]],
[[ 1. , 1. , 1. , ..., 1. ,
1. , 1. ],
[ 1. , 1. , 1. , ..., 1. ,
1. , 1. ],
[ 1. , 1. , 1. , ..., 1. ,
1. , 1. ],
...,
[ 0.17322835, 0.37401575, 0.4015748 , ..., 0.27952756,
0.27559055, 0.42519685],
[ 0.30314961, 0.24409449, 0.30314961, ..., 0.26771654,
0.27165354, 0.38976378],
[ 0.57086614, 0.61811024, 0.5984252 , ..., 0.28346457,
0.26771654, 0.34251969]],
[[ 1. , 1. , 1. , ..., 1. ,
1. , 1. ],
[ 1. , 1. , 1. , ..., 1. ,
1. , 1. ],
[ 1. , 1. , 1. , ..., 1. ,
1. , 1. ],
...,
[ 0.19685039, 0.34251969, 0.37795276, ..., 0.2519685 ,
0.25984252, 0.34251969],
[ 0.27165354, 0.21653543, 0.27559055, ..., 0.2519685 ,
0.26377953, 0.30708661],
[ 0.57480315, 0.63385827, 0.58661417, ..., 0.26377953,
0.25590551, 0.29527559]]])
In [120]: len(dd[0])
Out[120]: 3
In [121]: dd[0].shape
Out[121]: (3, 2058, 2607)
In [122]: matplotlib.pyplot.imshow(dd[0])
<details class='elided'>
<summary title='Show trimmed content'>···</summary>
------------------------------------------------------------
Traceback (most recent call last):
File "<ipython console>", line 1, in <module>
File "/Library/Python/2.6/site-packages/matplotlib/pyplot.py", line 2035, in imshow
ret = ax.imshow(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs)
File "/Library/Python/2.6/site-packages/matplotlib/axes.py", line 6272, in imshow
im.set_data(X)
File "/Library/Python/2.6/site-packages/matplotlib/image.py", line 372, in set_data
raise TypeError("Invalid dimensions for image data")
TypeError: Invalid dimensions for image data
thanks for any help!!!
Massimo.