Zeigt ein Bild mit pylab.imshow()

Ich bin relativ neu auf all dies, und ich begann, um das Lernprogramm auf die Bildanalyse, hier: http://www.pythonvision.org/basic-tutorial
Ich habe installiert alle Module, aber ich habe nicht sehr weit kommen, bevor er einen Haken.
wenn Sie versuchen, führen Sie die pylab.imshow(dna) Schritt es gibt die folgende Fehlermeldung zurück:

In [10]: pylab.imshow(dna)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-10-fc86cadb4e46> in <module>()
----> 1 pylab.imshow(dna)

 /usr/lib/pymodules/python2.7/matplotlib/pyplot.pyc in imshow(X, cmap, norm, aspect,    interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, hold, **kwargs)
   2375         ax.hold(hold)
   2376     try:
-> 2377         ret = ax.imshow(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs)
   2378         draw_if_interactive()
   2379     finally:

/usr/lib/pymodules/python2.7/matplotlib/axes.pyc in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs)
   6794                        filterrad=filterrad, resample=resample, **kwargs)
   6795 
-> 6796         im.set_data(X)
   6797         im.set_alpha(alpha)
   6798         self._set_artist_props(im)

/usr/lib/pymodules/python2.7/matplotlib/image.pyc in set_data(self, A)
    409         if (self._A.ndim not in (2, 3) or
    410             (self._A.ndim == 3 and self._A.shape[-1] not in (3, 4))):
--> 411             raise TypeError("Invalid dimensions for image data")
    412 
    413         self._imcache =None

TypeError: Invalid dimensions for image data

Ziemlich sicher, ich habe alle Anweisungen befolgt in der Anleitung auf den Brief, aber ich kann nicht herausfinden, war schief gehen

Dank

was ist dna? (was bedeutet type(dna) und dna.shape geben?) Es ist die Anhebung TypeError denn es ist nicht eine Art oder Form, die imshow weiß, wie man sich mit.
es ist genau das, was das Bild gespeichert wird als in dna = mahotas.imread('dna.jpeg') type(dna) gibt numpy.ndarray und dna.shape gibt (1024, 1344, 1)

InformationsquelleAutor Samuel Barnett | 2013-02-21

Schreibe einen Kommentar