Just installed SimpleCV Version 1.3 Superpack (Python 2.7) and trying the Hello Word application from Practical Computer Vision with SimpleCV
from SimpleCV import Camera, Display, Image
import time
# Initialize the camera
cam = Camera()
# Initialize the display
display = Display()
# Snap a picture using the camera
img = cam.getImage()
On the last line it fails with
OpenCV Error: Bad argument (Array should be CvMat or IplImage) in unknown function, file C:\slave\WinInstallerMegaPack\src\opencv\modules\core\src\array.cpp, line 1238
---------------------------------------------------------------------------
error Traceback (most recent call last)
C:\Python27\lib\site-packages\SimpleCV\Shell\Shell.pyc in <module>()
----> 1 img = cam.getImage()
C:\Python27\lib\site-packages\SimpleCV\Camera.pyc in getImage(self)
584
585 frame = cv.RetrieveFrame(self.capture)
--> 586 newimg = cv.CreateImage(cv.GetSize(frame), cv.IPL_DEPTH_8U, 3)
587 cv.Copy(frame, newimg)
588 return Image(newimg, self)
error: Array should be CvMat or IplImage
I am using the PS3 Eye camera via the CL-Eye Driver on a Windows 7 PC. That is via usb. The camera works fine otherwise. Any ideas how I can fix this?
cv.CreateImage wants an image or an array. I guess your cv.GetSize(frame)
is not returning an array (you ought to check exactly why that is).
You might also try
newimg = cv.CreateImage(frame, cv.IPL_DEPTH_8U, 3)
where frame
should be an IplImage according to the documentation.
But check that RetrieveFrame
isn't failing for some reason. For example, there are reports of camera access being denied for conflicts with Skype videochat functions. Are you running some software that might conceivably access the camera?
You can try downloading Process Explorer, and check (Find > Handle or DLL) if there's any process with a handle containing the string 'DeviceClasses'.
UPDATE: my bad, this section only applies to PCI cards and PSEye is USB { As a desperate measure you can take a snapshot with System Restore, and install FGeng's Universal Video Support driver for Windows 7. Then check whether OpenCV recognizes it as a camera connector.
http://www.fgeng.com/drivers.htm
If it doesn't, you can wipe it out with System Restore. It is a desperate measure because anything hogging the camera would probably hog the WDM too, and so chances for success are slim, but you never know. }
UPDATE: did a little bit of research. It turns out that the CL-Eye driver for PSEye is not without problems, depending on the application accessing it. The newer drivers have solved some problems ( threads of February 2012, maybe obsolete ). Sometimes, camera licensing may be an issue ( http://nuigroup.com/forums/viewthread/13699/ ).
You might try with the CL-Eye SDK instead of the driver, since the former explicitly lists OpenCV in the platforms, while the latter does not.
If you already have installed the SDK, you may want to check the camera number (#0, #1) just in case there's another imaging peripheral registered in the system.
Another possibility is to run DxDiag utility to diagnose a possible DirectShow snag.
Trouble here is that there's not much information to be had from the system.
You might want to copy "C:\Python27\lib\site-packages\SimpleCV\Camera.py" into a backup file, and modify it to be more informative, e.g. temporarily adding a print frame
between lines 585 and 586 (N.B.: the line must be indented exactly as the one above).