首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >OCR -- seamlessClone泊松融合

OCR -- seamlessClone泊松融合

作者头像
MachineLP
发布2019-05-26 15:29:24
发布2019-05-26 15:29:24
1.8K0
举报
文章被收录于专栏:小鹏的专栏小鹏的专栏

opencv:https://www.learnopencv.com/seamless-cloning-using-opencv-python-cpp/

OCR工程git:https://github.com/MachineLP/OCR_repo

看到这个题目是不是很突兀啊,OCR和泊松融合又有啥关系呢?

是这样的,因为在训练的时候需要生成训练字体,有时候需要融合不同的背景。

看一下效果:

python代码如下所示:

代码语言:javascript
复制
import cv2
import numpy as np

# Read images : src image will be cloned into dst
im = cv2.imread("bg.jpg")
obj= cv2.imread("lp.jpg")

# Create an all white mask
mask = 255 * np.ones(obj.shape, obj.dtype)

# The location of the center of the src in the dst
width, height, channels = im.shape
center = (height//2, width//2)

# Seamlessly clone src into dst and put the results in output
normal_clone = cv2.seamlessClone(obj, im, mask, center, cv2.NORMAL_CLONE)
mixed_clone = cv2.seamlessClone(obj, im, mask, center, cv2.MIXED_CLONE)

# Write results
cv2.imwrite("opencv-normal-clone-example.jpg", normal_clone)
cv2.imwrite("opencv-mixed-clone-example.jpg", mixed_clone)
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018年10月21日,如有侵权请联系 cloudcommunity@tencent.com 删除
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档