把语义图片叠加到原图上

import os
from scipy import ndimage
import pickle as plt
import cv2 as cv
from PIL import Image
import numpy as np
import math
import os
import os.path as path
dir_img="D:\\KinectData\\kinectnanping\\Depth\\"
push_img="D:\\labelme\\compash"


j=0
alpha = 0.6
beta = 1-alpha
gamma = 0
for i in range (45):
 name1 = str(i)+"rgb.png"
 img1 = cv.imread(name1)
 name2 = str(i)+"pre.png"
 img2 = cv.imread(name2)
 img_add = cv.addWeighted(img1, alpha, img2, beta, gamma)
 newname = str(j)+".jpg"
 img_path = path.join(push_img,newname)
 cv.imwrite(img_path,img_add)
 j=j+1
    #cv.imwrite("1.png",gray)

 

把标签在scannet里面做成000 然后重叠的时候 黑色区域就是透明的了~

 

 

alpha是原图的权重我取了0.6~~

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页