官网介绍
http://docs.opencv.org/2.4/modules/core/doc/operations_on_arrays.html#
代码
#include
#include
#include
#include "opencv2/objdetect/objdetect.hpp" #include
using namespace cv; using namespace std; int main() { Mat srcimage = imread("pic.jpg"); Mat dstimage = imread("pic.jpg"); Mat outnot,outxor, outor, outand; bitwise_not(srcimage, outnot); bitwise_xor(srcimage, dstimage, outxor); bitwise_or(srcimage, dstimage, outor); bitwise_and(srcimage, dstimage, outand); imshow("not", outnot); imshow("xor", outxor); imshow("or", outor); imshow("and", outand); waitKey(0); }
效果图
原图

运算后


bitwise_or bitwise_and
颜色对照表
http://jingyan.baidu.com/article/425e69e69690f0be15fc168a.html

逻辑运用表


逻辑运用详解

逻辑运算又称布尔运算 布尔用数学方法研究逻辑问题,成功地建立了逻辑演算。他用等式表示判断,把推理看作等式的变换。这种变换的有效性不依赖人们对符号的解释,只依赖于符号的组合规律 。这一逻辑理论人们常称它为布尔代数。20世纪30年代,逻辑代数在电路系统上获得应用,随后,由于电子技术与计算机的发展,出现各种复杂的大系统,它们的变换规律也遵守布尔所揭示的规律。逻辑运算 (logical operators) 通常用来测试真假值。最常见到的逻辑运算就是循环的处理,用来判断是否该离开循环或继续执行循环内的指令。
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/229583.html原文链接:https://javaforall.net
