利用颜色范围过滤
- InRange过滤
- 形态学提取
- 轮廓查找
- 外接矩形查找
- 位置确定与标定
#include<opencv2/opencv.hpp>
#include<iostream>
using namespace cv;
using namespace std;
Rect roi;
void processFrame(Mat &binary,Rect &rect);
int main(){
//读取视频
VideoCapture capture;
capture.open("D:/wv_demo.mp4");
if (!capture.isOpened()) {
printf("could not find video");
return -1;
}
Mat frame,mask;
Mat kernel1 = getStructuringElement(MORPH_RECT, Size(