#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, const char** argv)
{
Mat im = imread("00.jpg", 0);
Mat cont = ~im;
imwrite("1.jpg", cont);
threshold(cont, cont, 128, 255, THRESH_BINARY);
blur(cont, cont, Size(3, 3), Point(-1, -1));
imshow("均值模糊", cont);
GaussianBlur(cont, cont, Size(5, 5), 11, 11); // Size(5, 5)必须为奇数
imshow("高斯模糊", cont);
medianBlur(cont, cont, 5);
imshow("中值模糊", cont);
bilateralFilter(cont, cont, 5, 5 * 2, 5 / 2);
imshow("双边模糊", cont);
return 0;
}
C++ 【OpenCV】图像模糊-去锯齿-图像滤波
于 2024-07-17 10:45:42 首次发布