最終更新:2021-04-19 (月) 04:58:29 (1104d)  

ndarray.shape
Top / ndarray.shape

Tuple of array dimensions.

https://numpy.org/doc/stable/reference/generated/numpy.ndarray.shape.html

OpenCV

  • カラーの場合
    height, width, channel = image.shape
  • モノクロの場合
  • グレースケール画像であれば返戻値のtupleは行数と列数しか含みません
    height, width = image.shape

Python/タプル

  • 要素数が1のタプルは末尾にカンマが付く