Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The relevant snippet of the error message is <code>Unrecognized or unsupported array type in function cvGetMat</code>. The <code>cvGetMat()</code> function converts arrays into a <code>Mat</code>. A <code>Mat</code> is the matrix data type that OpenCV uses in the world of C/C++ (Note: the Python OpenCV interface you are utilizing uses Numpy arrays, which are then converted behind the scenes into <code>Mat</code> arrays). With that background in mind, the problem appears to be that that the array <code>im</code> you're passing to <code>cv2.imshow()</code> is poorly formed. Two ideas:</p> <ol> <li><p>This could be caused by quirky behavior on your webcam... on some cameras null frames are returned from time to time. Before you pass the <code>im</code> array to <code>imshow()</code>, try ensuring that it is not null.</p></li> <li><p>If the error occurs on <em>every</em> frame, then eliminate some of the processing that you are doing and call <code>cv2.imshow()</code> immediately after you grab the frame from the webcam. If that still doesn't work, then you'll know it's a problem with your webcam. Else, add back your processing line by line until you isolate the problem. For example, start with this:</p> <pre><code>while True: # Grab frame from webcam retVal, image = capture.read(); # note: ignore retVal # faces = cascade.detectMultiScale(image, scaleFactor=1.2, minNeighbors=2, minSize=(100,100),flags=cv.CV_HAAR_DO_CANNY_PRUNING); # Draw rectangles on image, and then show it # for (x,y,w,h) in faces: # cv2.rectangle(image, (x,y), (x+w,y+h), 255) cv2.imshow("Video", image) i += 1; </code></pre></li> </ol> <p>source: <a href="https://stackoverflow.com/questions/3940780/opencv-c-video-capture-does-not-seem-to-work">Related Question: OpenCV C++ Video Capture does not seem to work</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload