【预处理】(RGB通道+边缘)图像拼接4通道

import cv2
import os
import numpy as np
from PIL import Image
import tensorflow as tf


ROOT_DIR = os.path.abspath("../../")

edge_img = cv2.imread(os.path.join(ROOT_DIR, 'datasets/knifes/train/edges/000001_20180328_00000355.BMP'), 0)
raw_img = cv2.imread(os.path.join(ROOT_DIR, 'datasets/knifes/train/images/000001_20180328_00000355.BMP'))

edge_img = edge_img.reshape((edge_img.shape[0], edge_img.shape[1], 1))
print(edge_img.shape)
img = np.concatenate((raw_img, edge_img), 2)
print(img.shape)

猜你喜欢

转载自blog.csdn.net/qq_30159015/article/details/82117919
今日推荐