• OpenCV平滑处理示例代码


    #include<cv.h>
    #include<highgui.h>
    
    int main(int argc, char** argv)
    {
        IplImage* img = cvLoadImage(argv[1]);
        IplImage* img1 = cvLoadImage(argv[1]);
        IplImage* img2 = cvLoadImage(argv[1]);
        IplImage* img3 = cvLoadImage(argv[1]);
        IplImage* img4 = cvLoadImage(argv[1]);
        IplImage* img5 = cvLoadImage(argv[1]);
    
        cvSmooth(img, img1, CV_BLUR);
        cvSmooth(img, img2, CV_BLUR_NO_SCALE);
        cvSmooth(img, img3, CV_MEDIAN);
        cvSmooth(img, img4, CV_GAUSSIAN);
        cvSmooth(img, img5, CV_BILATERAL);
    
        cvNamedWindow("原图", CV_WINDOW_AUTOSIZE);
        cvNamedWindow("简单模糊", CV_WINDOW_AUTOSIZE);
        cvNamedWindow("简单无缩放变换的模糊", CV_WINDOW_AUTOSIZE);
        cvNamedWindow("中值模糊", CV_WINDOW_AUTOSIZE);
        cvNamedWindow("高斯模糊", CV_WINDOW_AUTOSIZE);
        cvNamedWindow("双边滤波", CV_WINDOW_AUTOSIZE);
    
        cvShowImage("原图", img);
        cvShowImage("简单模糊", img1);
        cvShowImage("简单无缩放变换的模糊", img2);
        cvShowImage("中值模糊", img3);
        cvShowImage("高斯模糊", img4);
        cvShowImage("双边滤波", img5);
    
        cvWaitKey(0);
        cvReleaseImage(&img);
        cvReleaseImage(&img1);
        cvReleaseImage(&img2);
        cvReleaseImage(&img3);
        cvReleaseImage(&img4);
        cvReleaseImage(&img5);
        cvDestroyWindow("原图");
        cvDestroyWindow("简单模糊");
        cvDestroyWindow("简单无缩放变换的模糊");
        cvDestroyWindow("中值模糊");
        cvDestroyWindow("高斯模糊");
        cvDestroyWindow("双边滤波");
    }

    注:此示例中没有设置cvSmooth()函数的后4个参数。

    结果图:
    这里写图片描述

  • 相关阅读:
    Script:Diagnostic ORA01000 maximum open cursors exceeded
    Script:Generating CREATE USER DDL Statements
    How many LMS processes for Oracle Rac 9i?
    ORA4030 PGA Usage Diagnostic Script
    Oracle Supplemental 补全日志介绍
    Oracle内部错误ORA600:[1112]
    Tune Very Large Hash Join
    How to increase System Change Number by manual
    Audit Logon above 9i
    Oracle学习笔记:创建logical standby
  • 原文地址:https://www.cnblogs.com/huahai/p/7271053.html
Copyright © 2020-2023  润新知