希望将CvMat转换为numpy数组。
From the OpenCV Python Cookbook :
>>> import cv, numpy # Comments added by me
>>> mat = cv.CreateMat(3, 5, cv.CV_32FC1) # make a 3x5 mat
>>> cv.Set(mat, 7) # set the cells to 7
>>> a = numpy.asarray(mat) # convert it to a numpy array
>>> print a
[[ 7. 7. 7. 7. 7.]
[ 7. 7. 7. 7. 7.]
[ 7. 7. 7. 7. 7.]]
Here is the numpy.asarray
documentation .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.