0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

numpyでのカラー画像合成

Posted at

前提

>>> 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配列を操る。

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?