// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
#include <opencv2/objdetect.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <iostream>
#include <iomanip>
#include <opencv2/opencv.hpp>
#include <vector>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
Mat img=imread("lena.png");
if(img.empty())
{
cout<<"open fail"<<std::endl;
}
Mat img0=Mat::zeros(200,200,CV_8UC1);
Mat img1=Mat::zeros(200,200,CV_8UC1);
Rect rect0(50,50,100,100);
img0(rect0)=Scalar(255);
Rect rect1(100,100,100,100);
img1(rect1)=Scalar(255);
imshow("img0",img0);
imshow("img1",img1);
Mat myAdd,myOr,myXor,myNot,imgNot;
bitwise_not(img0,myNot);
bitwise_and(img0,img1,myAdd);
bitwise_or(img0,img1,myOr);
bitwise_xor(img0,img1,myXor);
bitwise_not(img,imgNot);
imshow("myAdd",myAdd);
imshow("myOr",myOr);
imshow("myXor",myXor);
imshow("myNot",myNot);
imshow("imgNot",imgNot);
string sss;
cin>>sss;
return 0;
}
文章评论