2021
05-23
05-23
使用python和opencv的mask实现抠图叠加
背景照片:logo:合成效果:代码:importcv2ascv,numpyasnp#Loadtwoimagesimg1=cv.imread('227351.jpg')#背景img2=cv.imread('logo.png')#logo#Iwanttoputlogoontop-leftcorner,SoIcreateaROIrows,cols,channels=img2.shaperoi=img1[0:rows,0:cols]#Nowcreateamaskoflogoandcreateitsinversemaskalsoimg2gray=cv.cvtColor(img2,cv.COLOR_BGR2GRAY)ret,mask=cv.threshold(img...
继续阅读 >