标签:names 数据 named \n ima pen scalar main open
cv::inRange(src, lowerb, upperb, dst)
cv::bitwise_and(src1, src2, dst, mask) dst = src1 & src2
mask:为掩膜
与运算:和1与,数据不变,和0与,结果为0(RGB中黑色=0;)
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat src = imread("E:/LYPOpenCV3/JZG/ZGimg/person.jpg");
if (src.empty()){
printf("could not load image...\n");
return -1;
}
namedWindow("input image", CV_WINDOW_AUTOSIZE);
//imshow("input image", src);
Mat hsvimg;
cvtColor(src, hsvimg, COLOR_BGR2HSV);
//imshow("hsv", hsvimg);
Mat maskimg, maskimg_not, people;
inRange(hsvimg, Scalar(35, 43, 46), Scalar(77, 255, 255),maskimg);
imshow("mask", maskimg);
bitwise_not(maskimg, maskimg_not);
imshow("mask_not", maskimg_not);
bitwise_and(src, src, people, maskimg_not);
imshow("people", people);
waitKey(0);
return 0;
}
标签:names 数据 named \n ima pen scalar main open
原文地址:https://www.cnblogs.com/gfgwxw/p/10556127.html