cv2 mat   numpy

# Helper code
def load_image_into_numpy_array(image_param):
  img_shape = image_param.shape
  im_width = img_shape[1]
  im_height = img_shape[0]

  image_param1 = Image.fromarray(image_param.astype('uint8')).convert('RGB')
  #(im_width, im_height) = image_param.size
  #im_width = 640
  #im_height = 480
  return np.array(image_param1.getdata()).reshape(
      (im_height, im_width, 3)).astype(np.uint8)

 

相关文章:

  • 2022-12-23
  • 2021-06-30
  • 2021-11-15
  • 2021-07-27
  • 2021-10-17
  • 2022-02-03
  • 2022-12-23
猜你喜欢
  • 2022-01-01
  • 2021-11-29
  • 2021-09-28
  • 2022-12-23
  • 2021-09-26
相关资源
相似解决方案