中值滤波结果

原图像
Opencv C++成长之路(四):中值滤波
中值滤波结果
Opencv C++成长之路(四):中值滤波

Show me the code

#include <iostream>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <string>
#include <cmath>

using namespace std;

int main() {
    // 图像路径
    const string fileName = "xxx.jpg";
    
    // 读入图片
    cv::Mat origin = cv::imread(fileName);
    
    // 创建结果存放位置
    cv::Mat result;
    
    // 设置中值滤波窗大小
    const int winSize = 21;
    
    // 中值滤波
    cv::medianBlur(origin, result, winSize);
    
    // 显示原图
    cv::imshow("Origin Image", origin);
    
    // 显示中值滤波后的图像
    cv::imshow("Result", result);
    
    cv::waitKey(0);
}

相关文章:

  • 2021-09-25
  • 2021-11-07
  • 2021-10-26
  • 2021-11-17
  • 2021-11-07
  • 2021-10-31
  • 2021-11-07
猜你喜欢
  • 2021-05-07
  • 2022-02-07
  • 2021-12-26
  • 2021-04-16
  • 2021-11-17
  • 2022-02-07
  • 2021-05-09
相关资源
相似解决方案