opencv learning log 17-mean filtering

foreword

This article focuses on median filtering in opencv image processing.

First, the mean filter

//第二题 均值滤波
#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);



	}
}

Summarize

1. The code can be run directly, if you don't understand, please leave a message.

Guess you like

Origin blog.csdn.net/taiyuezyh/article/details/122799868