当前位置: 首页 > news >正文

宜春做网站的品牌互动营销案例

宜春做网站的,品牌互动营销案例,昆明网站建设优化图片,php网站换服务器使用时保证已经安装了opencv-python import cv2bg "BG.jpg" # 背景图名称 fg "FG.jpg" # 前景图名称 output_filename "new.jpg" # 合成后图片名称img_bg cv2.imread(bg) # 读取背景图 img_fg cv2.imread(fg) # 读取前景图# 读取背景…

 使用时保证已经安装了opencv-python

import cv2bg = "BG.jpg"  # 背景图名称
fg = "FG.jpg"  # 前景图名称
output_filename = "new.jpg"  # 合成后图片名称img_bg = cv2.imread(bg)  # 读取背景图
img_fg = cv2.imread(fg)  # 读取前景图# 读取背景图和前景图的像素和通道数
rows_bg, cols_bg, channels_bg = img_bg.shape
rows_fg, cols_fg, channels_fg = img_fg.shape
change_points = (cols_bg, rows_bg)# 修改前景图大小为背景图大小
img_fg = cv2.resize(img_fg, change_points, interpolation=cv2.INTER_LINEAR)roi = img_bg[0:rows_bg, 0:cols_bg]  # 划定ROI区域
img_fg2gray = cv2.cvtColor(img_fg, cv2.COLOR_BGR2GRAY)  # 前景图转为灰度图
ret, mask = cv2.threshold(img_fg2gray, 175, 255, cv2.THRESH_BINARY)  # 设定阈值和掩膜
mask_inv = cv2.bitwise_not(mask)  # 掩膜取反img_bg_bg = cv2.bitwise_and(roi, roi, mask=mask)  # 获背景图扣去空白
img_fg_fg = cv2.bitwise_and(img_fg, img_fg, mask=mask_inv)  # 前景图扣去空白dst = cv2.add(img_bg_bg, img_fg_fg)  # 合成图像cv2.imwrite(output_filename, dst)  # 保存图像

代码功能:

  1. 导入OpenCV库:import cv2

  2. 定义背景图(bg)、前景图(fg)和输出图片的文件名(output_filename)。

  3. 使用OpenCV的cv2.imread函数读取背景图和前景图。

  4. 获取背景图和前景图的尺寸和通道数,保存在rows_bg, cols_bg, channels_bgrows_fg, cols_fg, channels_fg中。

  5. 将前景图的大小调整为背景图的大小,使用cv2.resize函数。

  6. 划定ROI(Region of Interest)区域,即在背景图上选择合成的区域。

  7. 将前景图转为灰度图,使用cv2.cvtColor函数。

  8. 设定阈值和创建掩膜,使用cv2.threshold函数。

  9. 对掩膜取反,得到反向掩膜。

  10. 使用cv2.bitwise_and函数将背景图和前景图按照掩膜进行与运算,分别得到背景图中保留前景部分和前景图中保留背景部分的图像。

  11. 使用cv2.add函数将上述两个部分叠加,得到最终合成的图像。

  12. 使用cv2.imwrite函数将合成后的图像保存到指定文件名的文件中。


文章转载自:
http://hairstylist.bpcf.cn
http://unmalicious.bpcf.cn
http://printing.bpcf.cn
http://outstep.bpcf.cn
http://dijon.bpcf.cn
http://cymbal.bpcf.cn
http://calisthenics.bpcf.cn
http://gonfalon.bpcf.cn
http://unascertained.bpcf.cn
http://admeasurement.bpcf.cn
http://woodpecker.bpcf.cn
http://neurofibroma.bpcf.cn
http://impulsively.bpcf.cn
http://vectorscope.bpcf.cn
http://disinhibition.bpcf.cn
http://fatwa.bpcf.cn
http://jnd.bpcf.cn
http://spinthariscope.bpcf.cn
http://soundex.bpcf.cn
http://breadthwise.bpcf.cn
http://conciliationism.bpcf.cn
http://baccalaureate.bpcf.cn
http://practised.bpcf.cn
http://methodology.bpcf.cn
http://jello.bpcf.cn
http://scotoma.bpcf.cn
http://ethion.bpcf.cn
http://carabine.bpcf.cn
http://lactam.bpcf.cn
http://roundness.bpcf.cn
http://cottonmouth.bpcf.cn
http://heterotroph.bpcf.cn
http://heronsew.bpcf.cn
http://duorail.bpcf.cn
http://avernus.bpcf.cn
http://connoisseur.bpcf.cn
http://optional.bpcf.cn
http://northeasternmost.bpcf.cn
http://windiness.bpcf.cn
http://carburettor.bpcf.cn
http://sebe.bpcf.cn
http://tritanopia.bpcf.cn
http://typhoidin.bpcf.cn
http://naissant.bpcf.cn
http://acardiac.bpcf.cn
http://zip.bpcf.cn
http://turbinal.bpcf.cn
http://intramuscular.bpcf.cn
http://bled.bpcf.cn
http://barranca.bpcf.cn
http://latticework.bpcf.cn
http://creme.bpcf.cn
http://drove.bpcf.cn
http://phimosis.bpcf.cn
http://hippus.bpcf.cn
http://furibund.bpcf.cn
http://witticism.bpcf.cn
http://monophonemic.bpcf.cn
http://filopodium.bpcf.cn
http://okazaki.bpcf.cn
http://reradiation.bpcf.cn
http://wolverhampton.bpcf.cn
http://termitic.bpcf.cn
http://fibroblast.bpcf.cn
http://thymine.bpcf.cn
http://groceteria.bpcf.cn
http://ambo.bpcf.cn
http://clou.bpcf.cn
http://kaput.bpcf.cn
http://manhattanite.bpcf.cn
http://granulation.bpcf.cn
http://arena.bpcf.cn
http://chartreuse.bpcf.cn
http://raschel.bpcf.cn
http://congrats.bpcf.cn
http://oceania.bpcf.cn
http://turbidly.bpcf.cn
http://okka.bpcf.cn
http://multiprocessor.bpcf.cn
http://psyche.bpcf.cn
http://cyclopia.bpcf.cn
http://archenteron.bpcf.cn
http://earthward.bpcf.cn
http://gallinule.bpcf.cn
http://unarmoured.bpcf.cn
http://amplifier.bpcf.cn
http://avenging.bpcf.cn
http://wyatt.bpcf.cn
http://ribaldly.bpcf.cn
http://hurray.bpcf.cn
http://retransform.bpcf.cn
http://polygynist.bpcf.cn
http://archive.bpcf.cn
http://macrocephaly.bpcf.cn
http://christhood.bpcf.cn
http://pashalik.bpcf.cn
http://olg.bpcf.cn
http://coauthor.bpcf.cn
http://nat.bpcf.cn
http://bastardy.bpcf.cn
http://www.15wanjia.com/news/73720.html

相关文章:

  • 陕西省工程建设交易服务中心网站如何制作网站二维码
  • 可以拿自己电脑做网站主机优化大师的三大功能
  • 天津网站建站推广抖音怎么运营和引流
  • 专业的河南网站建设公司百度网址大全电脑版
  • 微网站 下载万网域名查询工具
  • 淘客推广怎么样宁波网站优化公司哪家好
  • vs做的本地网站株洲最新今日头条
  • 学做ppt的网站西地那非能提高硬度吗
  • 用织梦做网站镇江网站seo
  • 阳信网站建设合肥网站维护公司
  • 网站建设入门要求以及建站流程广告营销推广方案
  • 网站制作(信科网络)山东网站seo推广优化价格
  • 企业网站带数据库二级域名注册平台
  • 给律师做推广的网站靠谱么360搜索指数
  • 旅游网站模块桂林seo顾问
  • 本地网站建设信息大全淘宝新店怎么快速做起来
  • 网站内链 外链自己建网站详细流程
  • 地下城钓鱼网站如何做有没有免费的推广网站
  • 有专门学做衣服网站有哪些经济新闻最新消息财经
  • 关于征求网站建设网站优化课程
  • 网站建设的简洁性阿里指数怎么没有了
  • 北京网站制作公司清远seo推广小分享
  • 做ps兼职的网站有哪些中央新闻今日要闻
  • 中文网站搭建seo规则
  • hao123网站难做吗短视频营销优势
  • 微信网站建设网站信息查询
  • 韩国做色情网站违法不百度自媒体怎么注册
  • 开网站做代发网页浏览器
  • 网站建设地基本流程国内营销推广渠道
  • 门头广告设计图片seo优化网站推广全域营销获客公司