0
1

More than 3 years have passed since last update.

画像のチャネルごとの輝度値の出し方(OpenCV)

Posted at

画像を分析する際にチャネルごとに情報を抽出する方法

import cv2

img = cv2.imread('sample.jpg')

# 画像をチャネルごとに分割
blue, green, red = cv2.split(img)

# 平均値を取得
green.mean()

# 表示する
blue = np.zeros([img.shape[0], img.shape[1]])
red = np.zeros([img.shape[0], img.shape[1]])
img = cv2.merge((blue, green, red))

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1