image class broken with new packages under Windows

Showing 1-4 of 4 messages
image class broken with new packages under Windows Zsolt Ero 3/29/12 10:52 AM
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]:
Re: image class broken with new packages under Windows Zsolt Ero 3/29/12 10:53 AM
I forgot, SimpleCV is from git, as of now.
Re: [simplecv] Re: image class broken with new packages under Windows Krishna Mohan 3/31/12 5:19 PM
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
Re: [simplecv] Re: image class broken with new packages under Windows Zsolt Ero 3/31/12 6:35 PM
Hi Krishna,

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

Regards,
Zsolt