OpenCV error: invalid argument (array must be CvMat or IplImage). File C: \ slave \ WinInstallerMegaPack \ src \ opencv \ modules \ core \ src \ array.cpp, line 1238

Just install SimpleCV version 1.3 Superpack (Python 2.7) and try the Hello Word app 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 this does not work 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 a PS3 Eye camera using the CL-Eye driver on a Windows 7 PC. This is via usb. Otherwise, the camera is operating normally. Any ideas how I can fix this?

+4
source share
2 answers

cv.CreateImage wants an image or array. I think your cv.GetSize(frame) not returning an array (you should check exactly why this is).

You can also try

  newimg = cv.CreateImage(frame, cv.IPL_DEPTH_8U, 3) 

where frame should be IplImage as per documentation.

http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#videocapture-retrieve

But make sure the RetrieveFrame not working for any reason. For example, there are reports that access to cameras is prohibited for conflicts with Skypechatchat features. Are you using some kind of software that could possibly access the camera?

You can try loading Process Explorer and checking (Find> Handle or DLL) if there is any process with a handle containing the string "DeviceClasses".

UPDATE : my bad, this section only applies to PCI cards, and PSEye to USB {As a desperate measure, you can take a picture using System Restore and install the FGeng Universal Video Support driver for Windows 7. Then check if OpenCV recognizes it as a connector cameras.

http://www.fgeng.com/drivers.htm

If this is not the case, you can erase it using System Restore. This is a desperate measure, because everything that clogs the camera is likely to generate WDM, and therefore the chances of success are slim, but you never know. }

UPDATE : a bit of research. It turns out that the CL-Eye driver for PSEye is not without problems, depending on the access to the application. The new drivers solved some problems (the February 2012 threads may be outdated). Sometimes camera licensing can be a problem ( http://nuigroup.com/forums/viewthread/13699/ ).

You can try with the CL-Eye SDK instead of the driver, since the first explicitly lists OpenCV on the platforms, and the second does not.

If you have already installed the SDK, you can check the camera number (# 0, # 1) if another peripheral image processing device is registered in the system.

Another option is to run the DxDiag utility to diagnose a possible DirectShow termination.

The problem is that there is not much information in the system.

You might want to copy "C: \ Python27 \ lib \ site-packages \ SimpleCV \ Camera.py" to the backup file and modify it to be more informative, for example. temporarily adding a print frame between lines 585 and 586 (NB: the line should be indented exactly the same as above).

+1
source

No problem with SimpleCV. Your camera should have some problems. Try reinstalling OpenCV. Install the latest version of OpenCV (OpenCV 2.4.2)

To find out if your camera works with OpenCV,

 import cv2 c = VideoCapture(0) val, img = c.read() print val #this should be True print img #this should not be all 0s 
+1
source

Source: https://habr.com/ru/post/1434922/


All Articles