Arguments to cv2::imshow
The function has the following docstring: imshow(winname, mat) -> None
.
You can see the doc string by typing cv2.imshow.__doc__
in the interpreter.
Try cv2.imshow('Image', cvimage)
.
tl;dr : In original question, first argument of "window name" was missing. "imshow" takes two parameters and only one was supplied.
The question technically asks how to convert a NumPy Array (analogous to CV2 array) into a Mat object (CV). For anyone who is interested, this can be done by:
mat_array = cv.fromarray(numpy_array)
where mat_array is a Mat object, and numpy_array is a NumPy array or image. I would suggest staying away from older CV structures where possible. Numpy arrays offer much better performance than implemenations in native Python
Mat
object was needed because C/C++ lacked a standard/native implementation of matrices.
However, numpy
's array
is a perfect replacement for that functionality. Hence, the cv2
module accepts numpy.array
s wherever a matrix is indicated in the docs.