Mean Gaussian blur and blur

#include <opencv2/opencv.hpp>
#include <iostream>
#include <math.h>
using namespace cv;
using namespace std;


const  int g_nTrackbarMaxValue = . 9 ;      // definition of track bar maximum 
int g_nTrackbarValue;                    // definition of track bar initial value 
int g_nKernelValue;                      // define kernel size 
Mat src, dst;

// mean filter 
void on_kernelTrackbar ( int , void * )
{
    // recalculated kernel size input values 
    g_nKernelValue g_nTrackbarValue * = 2 + . 1 ;

    // mean filter function 
    blur (src, dst, Size ( g_nKernelValue, g_nKernelValue));

    imshow ( " mean filter " , DST);
}

// Gaussian 
void on_kernelTrackbar2 ( int , void * )
{
    // recalculated kernel size input values 
    g_nKernelValue g_nTrackbarValue * = 2 + . 1 ;

    // mean filter function of 
    the Gaussian Blur (the src, DST, Size (g_nKernelValue, g_nKernelValue), . 11 , . 11 );

    imshow ( " mean filter " , DST);
}

int main ()
{
    
    //原图
    src = imread(".//pic//kate.png",IMREAD_UNCHANGED);
    
    if (!src.data)
    {
        cout << "load error" << endl;
        return -1;
    }
    

    namedWindow ( " mean filter " , WINDOW_AUTOSIZE);    // definition of the filtered image display window properties
     // definition of track bar and name maximum 
    char kernelName [ 20 is ];
    sprintf(kernelName, "kernel尺寸 %d", g_nTrackbarMaxValue);

    // Create a track bar 
    createTrackbar (kernelName, " mean filter " , & g_nTrackbarValue, g_nTrackbarMaxValue, on_kernelTrackbar2);
    on_kernelTrackbar(g_nTrackbarValue, 0);


    waitKey(0);
    return 0;
}

 

Guess you like

Origin www.cnblogs.com/xiaochi/p/11997023.html