how to get the number of channels from an image, in OpenCV 2?

后端 未结 3 1326
情话喂你
情话喂你 2020-12-30 23:34

The answers at Can I determine the number of channels in cv::Mat Opencv answer this question for OpenCV 1: you use the Mat.channels() method of the image.

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-30 23:49

    As i know, u should use image.shape[2] to determine number of channels, not len(img.shape), the latter gives the dimensions of the array.

提交回复
热议问题