前提
>>> imR.dtype
dtype('bool')
>>> im0.dtype
dtype('uint16')
imRは1bit画像、im0は16bit画像。
im0を適切にモノクロ画像として、imRを赤色で塗る。
実例
from skimage.io import imsave
import numpy as np
byW = np.where(im0>1024,255,im0/4).astype('uint8')
byR = 255*imR.astype('uint8')
by = np.zeros((byW.shape[0],byW.shape[1],3),'uint8')
by[:,:,0] = np.where(byR==255,255,byW)
by[:,:,1] = np.where(byR==255,0,byW)
by[:,:,2] = np.where(byR==255,0,byW)
np.whereで直接numpy
配列を操る。