上传者: 38720256
|
上传时间: 2021-11-18 03:03:27
|
文件大小: 147KB
|
文件类型: -
主要步骤
1.生成普通python数组(bytearray(),os.urandom())
2.转换成numpy数组(numpy.array())
3.通过reshape将数组转换到所需的维数
4.以图像的形式显示出来(cv.imshow())
代码
import os
import cv2 as cv
import numpy as np
# Make an array of 120000 random bytes
randomByteArray = bytearray(os.urandom(120000))
# translate into numpy array
flatNumpyAr