image class broken with new packages under Windows

410 views
Skip to first unread message

Zsolt Ero

unread,
Mar 29, 2012, 1:52:42 PM3/29/12
to simp...@googlegroups.com
There are some posts on the Q&A site about not-working cameras, and one of them (http://help.simplecv.org/question/171/error-array-should-be-cvmat-or-iplimage-on-laptop) has the same error I've just come up with.

It has nothing to do with camera, it is something with the newer packages <> image class incompatibility on windows. I've just done a new install, this time with ActivePython and downloaded all the latest packages, getting Pygame from the official website (the others from ActivePython's pypm).

So what is happening is that even a simple img.show() or Display() is giving the error.

Here is a full error-log:

In [3]: from SimpleCV import *

In [6]: img = Image("stache.png")

In [7]: img.show()
C:\Users\zs\AppData\Roaming\Python\Python27\site-packages\simplecv-1.2-py2.7.egg
\SimpleCV\ImageClass.py:431: UserWarning: Couldn't load Image
  warnings.warn("Couldn't load Image")
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
e:\University\SDP\SimpleCV-src\SimpleCV\examples\<ipython-input-7-cf128be59794>
in <module>()
----> 1 img.show()

C:\Users\zs\AppData\Roaming\Python\Python27\site-packages\simplecv-1.2-py2.7.egg
\SimpleCV\ImageClass.pyc in show(self, type)
   3039         elif (type == 'window'):
   3040           from SimpleCV.Display import Display
-> 3041           d = Display(self.size())
   3042           self.save(d)
   3043           return d

C:\Users\zs\AppData\Roaming\Python\Python27\site-packages\simplecv-1.2-py2.7.egg
\SimpleCV\Display.pyc in __init__(self, resolution, flags, title, displaytype, h
eadless)
    136         if not displaytype == 'notebook':
    137             self.screen = pg.display.set_mode(resolution, flags)
--> 138         scvLogo = SimpleCV.Image("simplecv").scale(32,32)
    139         pg.display.set_icon(scvLogo.getPGSurface())
    140         if flags != pg.FULLSCREEN and flags != pg.NOFRAME:

C:\Users\zs\AppData\Roaming\Python\Python27\site-packages\simplecv-1.2-py2.7.egg
\SimpleCV\ImageClass.pyc in scale(self, width, height)
   1277
   1278         scaled_bitmap = cv.CreateImage((w, h), 8, 3)
-> 1279         cv.Resize(self.getBitmap(), scaled_bitmap)
   1280         return Image(scaled_bitmap, colorSpace=self._colorSpace)
   1281

TypeError: CvArr argument 'src' must be IplImage, CvMat or CvMatND. Use fromarra
y() to convert numpy arrays to CvMat or cvMatND

In [8]:

Zsolt Ero

unread,
Mar 29, 2012, 1:53:28 PM3/29/12
to simp...@googlegroups.com
I forgot, SimpleCV is from git, as of now.

Krishna Mohan

unread,
Mar 31, 2012, 8:19:40 PM3/31/12
to simp...@googlegroups.com
Hi,
After Importing OpenCV, check the value of  ' PIL_ENABLED '  (Without the quotes of course).

If you are getting False value, then you dont have PIL installed, If you installed SimpleCV using the windows installer, this may have been blocked if you are behind a firewall (your university maybe? )

The fix is very simple though , you can install PIL in one of the following methods

easiest method would probably be
 Open cmd.exe
 run the following commands
 
 set HTTP_PROXY=http://your.proxy.com:yourPort
 easy_install PIL

If this does not work, then you can just install it from their website
http://www.pythonware.com/products/pil/


The problem here is not due to error in reading the image, but there is a small logo of simplecv trying to load on the window, which is loaded through PIL. This is a small bug that needs to be fixed, (and also an easy fix bug)..


Tell me if this works

Zsolt Ero

unread,
Mar 31, 2012, 9:35:32 PM3/31/12
to simp...@googlegroups.com
Hi Krishna,

Thanks, it works!!! With ActivePython I could just install it using
"pypm install pil" and it worked!

Regards,
Zsolt

Reply all
Reply to author
Forward
0 new messages