在Python中添加维度的副本 - numpy.ndarray

时间:2016-05-30 16:44:21

标签: python numpy opencv3.0 dimensions

我有一个像这样的形象(numpy.ndarray):

In : print(img.shape)
Out : (240, 320, 1)

In : print(img) # The output it's simplified
Out:[[[121]
      [119]
      [118]
      ..., 
      [ 39]
      [ 43]
      [ 44]]

我需要添加副本,如下所示:

shape (240, 320, 3) 
    [[[121   121   121]
      [119   119   119]
      [118   118   118]
      ..., 
      [ 39   39   39]
      [ 43   43   43]
      [ 44   44   44]]

有关如何实现这一目标的任何提示?

0 个答案:

没有答案