Unsupported Array Type in ‘cvGetMat’ – Raspberry Pi

  arrays, numpy, python, raspberry-pi, traceback

This is my Python code:

import cv2
img = cv2.imread('./images/image.jpg')
cv2.imshow('Input image', img)

When I run the following code, I get this error:

Traceback (most recent call last):
File "/home/pi/Desktop/sample.py", line 3, in <module>
cv2.imshow('Input image', img)
cv2.error: OpenCV(4.5.3) /tmp/pip-wheel-pd499c9i/opencv- 
python_3a15e83eee864e65b7311a199a94e9f1/opencv/modules/core/src/array.cpp:2494: error: 
(-206:Bad flag (parameter or structure field)) Unrecognized or unsupported array type in 
function 'cvGetMat'

Some people say that the directory might not be right, but I checked the directory and everything is fine. I even installed Numpy (version – 1.21.2).

Can anyone please help me? Thanks in Advance

Source: Python Questions

One Reply to “Unsupported Array Type in ‘cvGetMat’ – Raspberry Pi”