简体   繁体   中英

Image processing - How to stack one channel images to create a 2 channel array

i have two datasets of images, one with 900 samples and another with other 900 samples. If i take just one image of each dataset and convert them to array they are of shape (1, 128, 118), after the images are read in grayscale mode.

How could i stack these two arrays to be (2, 128, 118)?

import numpy as np
import cv2
img1 = cv2.imread(...)
img2 = cv2.imread(...)
np.stack([img1,img2],axis=0)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM