惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
博客园 - 叶小钗
GbyAI
GbyAI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Stack Overflow Blog
Stack Overflow Blog
Jina AI
Jina AI
Microsoft Security Blog
Microsoft Security Blog
T
Tailwind CSS Blog
S
SegmentFault 最新的问题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
N
Netflix TechBlog - Medium
B
Blog
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
雷峰网
雷峰网
Apple Machine Learning Research
Apple Machine Learning Research
人人都是产品经理
人人都是产品经理

博客园 - 范晨鹏

分省svg代码 noi数据分析工具 unreal engine 5 移动到其它主机时的 epic games launcher 识别修复 楼宇对讲自动开门的设计与实现 循*迹小车轨道识别算法 树莓派ssh卡顿之双机互联解决 ntfs 时间戳换算 安装 django 教程 利用 dns 实现 app简易抓包 安装django 框架 tensorflow 学习记记——环境安装 centos升级gcc centos 7 中 tomcat 安装 centos中 mysql 5.7安装 xsocks 64位平台下编译问题小记 openwrt 编译newifi 应用程序 mingw 环境编译 liburl故障一例 szutsid youku.com awstats 日志分析工具linux下的安装和使用
用pillow和 opencv做透明通道的两图混全(blend)
范晨鹏 · 2018-09-21 · via 博客园 - 范晨鹏
from PIL import Image as image 

foreground = image.open("donkey.png")
background = image.open( "back.jpg" )
alpha = image.open( "donkeyAlpha.png" )
outImage = image.composite( foreground, background, alpha )
outImage.save( "./pilblend.png" )
import cv2
foreground = cv2.imread("donkey.png")
background = cv2.imread("back.jpg")
alpha = cv2.imread("donkeyAlpha.png")
# Convert uint8 to float
foreground = foreground.astype(float)
background = background.astype(float)
# Normalize the alpha mask to keep intensity between 0 and 1
alpha = alpha.astype(float)/255
foreground = cv2.multiply(alpha, foreground)
background = cv2.multiply(1.0 - alpha, background)
outImage = cv2.add(foreground, background)
cv2.imwrite( "./cv2blend.png"  ,outImage )