python - python图像处理中如何做OR掩码操作?

标签 python opencv image-processing mask

我有一个 C# 代码,它给我一个屏蔽结果。但我无法在 python 中做到这一点。谁能帮我怎么做?在 python 中有可能吗?我几乎浏览了 python openCV 文档

public void OROPeration()
       {
           IplImage orImage = Cv.CreateImage(src.Size, BitDepth.U8, 3);
           Cv.Or(src, mask, orImage, null);
           Cv.SaveImage("4.jpg", orImage);
       }

原图

enter image description here 屏蔽图像 enter image description here 结果需要获取 enter image description here

最佳答案

opencv 中有一个函数,bitwise_or,我猜它会做你想要的。

import cv2 

fin_image = cv2.bitwise_or(src_image, masking_image)

关于python - python图像处理中如何做OR掩码操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37764648/

相关文章:

python - 如何使用 pyspark 读取文件并将其转换为数据框?

python - scipy.ndimage.filter.laplace() 中使用的拉普拉斯掩码/内核是什么?

java - OpenCV 将具有任意轮廓的形状转换为矩形

python - 如何对包含混合数字和字符串的 DataFrame 中的数字求和

python - 如何使用task_name检索排队任务

python - 通过直方图匹配比较图像

python - OpenCV 未在图像上添加线和点

python - PIL和cv2中不同的像素信息

c++ - OpenPose:E0312/没有从 “fLS::clstring”到 “const op::String”的适当的用户定义转换以及其他错误

opencv - 自适应阈值中窗口大小的选择