当前位置:网站首页>mask + rgb实现背景减除
mask + rgb实现背景减除
2022-04-21 06:27:00 【sxxblogs】
import cv2
import numpy as np
rgb_raw_pth='D:/Program/lightv1.2.5/write-01_2021-04-29 15_03_29/rgb/76.jpg'
rgb_mask_pth='D:/Program/lightv1.2.5/write-01_2021-04-29 15_03_29/sg_result76.bmp'
rgb=cv2.imread(rgb_raw_pth,-1)
mask=cv2.imread(rgb_mask_pth,-1)
#print(mask)
mask_3 = np.zeros_like(rgb)
mask_3[:,:,0] = mask
mask_3[:,:,1] = mask
mask_3[:,:,2] = mask
sub=cv2.bitwise_and(rgb,mask_3)
#sub= np.zeros_like(rgb)
#for row in range(mask.shape[0]):
#for col in range(mask.shape[1]):
# 如果掩图的像素不等于0,则dst(x,y) = scr(x,y)
#if mask[row, col] != 0:
# dst_image和scr_Image一定要高宽通道数都相同,否则会报错
#rgb[row, col] = rgb[row, col]
# 如果掩图的像素等于0,则dst(x,y) = 0
#elif mask[row, col] == 0:
#rgb[row, col] = 0
cv2.imshow('sub',sub)
cv2.waitKey(0)
cv2.destroyAllWindows()
版权声明
本文为[sxxblogs]所创,转载请带上原文链接,感谢
https://blog.csdn.net/sunnyblogs/article/details/116495989
边栏推荐
- Guaba and Computational Geometry
- SQL--数据的过滤和分组
- Reflection cannot find the class message classnotfound of UDF when executing flinksql code
- 平面半交板子
- PowerShell - batch file deferred replication
- 对个人与环境的几个观点
- WordPress超时问题解决方法
- Solve the problem that the replacement traverses the circular call, resulting in the subsequent replacement replacing the data of the previous replacement
- The difference between on and where followed by conditions in the left join association table
- Fundamentals of graphics | skin rendering
猜你喜欢

Shader tool for 3d-max (stroke)

Format checking tool eslint

WordPress plugin - display posts

效率工具|专用截图辅助软件PureRef

pg 数据库不能使用 zh_CN.UTF-8:initdb: error: locale “zh_CN.UTF-8“ requires unsupported encoding “GBK“

Database splitting under microservice architecture

在ensp上配置安全策略

C#中的类型转换

Fundamentals of graphics | skin rendering

SQL--数据定义
随机推荐
云计算中网络基础知识
dpdk-16.04 igb crc length 统计问题
顺序表的建立和增删改查
WordPress plugin - display posts
WordPress插件-Display Posts
「Tarjan」有向图强连通分量
WordPress插件-WP Mail SMTP
Sum of Numerators 思维
PowerShell - 因为在此系统上禁止运行脚本
Fundamentals of graphics | area light rendering based on LTC
Open platform and its technical architecture
Could not initialize cudnn ,please check cudnn installation.
虚拟化特性介绍
Integers Have Friends 区间gcd + 双指针
C语言版:双向链表的建立以及基本操作
基于领域的方法-评分预测
获取进程最后一次执行的 cpu 核的方法及原理
【LeetCode 202】快乐数
图形学基础|实时阴影渲染
【LeetCode 401】二进制手表