あれ、この画像ってグレースケール画像だっけ?と思った時のためのメモです。 環境は - Python 3.8 - OpenCV 4.0.1 です。 import cv2 # 画像ファイル名 fname = "input.png" # 画像の読み込み img = cv2.imread(fname) # RBG成分の分離 img_blue, img_green, img_red = ...
now the modification of fname happens it two places -- here and below during the return. Can you move the fname = str (op.abspath (fname)) after this line, then just return fname at the end? That way ...