前言
这篇文章中主要讲述opencv图像处理中的中值滤波。
一、均值滤波
//第二题 均值滤波
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
int main()
{
VideoCapture cap;
cap.open("C://Users//john//Desktop//VID.mp4");
cv::Size rect;
rect.width = 5;
rect.height = 5;
if (!cap.isOpened())
{
std::cout << "不能打开视频文件" << std::endl;
return -1;
}
double fps = cap.get(CAP_PROP_FPS);
std::cout << "fps" << fps << std::endl;
while (1)
{
cv::Mat frame;
cv::Mat resframe;
bool rSucess = cap.read(frame);
cv::imshow("frame", frame);
blur(frame, resframe, rect);
cv::imshow("resframe", resframe);
waitKey(0);
}
}
总结
1.代码可以直接运行,如果有不懂的请留言哦。