OpenCV 里的sigma 是多少(What is the Sigma in opencv)

std::vector<double> createGaussianKernal( int kernal_size , float sigma=0 )
{
    int radius = kernal_size / 2;
    //sigma = sigma > 0 ? sigma : radius*0.3 + 0.8;
    std::vector<double> kernal;// (kernal_size);

    for (int i = -radius; i != radius + 1; ++i)
    {
        double x = i;
        double val = (1.0 / (sqrt(2 * M_PI) *sigma))   *  exp((-x*x) / (2 * sigma*sigma));
        kernal.push_back(val);
    }

    double sum = 0;
    for (int i = 0; i != kernal.size(); ++i) {
        sum += kernal[i];
    }

    for (int i = 0; i != kernal.size(); ++i) {
        kernal[i] /= sum;
    }
    return kernal;
}

OpenCV 使用的是这个 0.2 * filterWidth 

————————
std::vector<double> createGaussianKernal( int kernal_size , float sigma=0 )
{
    int radius = kernal_size / 2;
    //sigma = sigma > 0 ? sigma : radius*0.3 + 0.8;
    std::vector<double> kernal;// (kernal_size);

    for (int i = -radius; i != radius + 1; ++i)
    {
        double x = i;
        double val = (1.0 / (sqrt(2 * M_PI) *sigma))   *  exp((-x*x) / (2 * sigma*sigma));
        kernal.push_back(val);
    }

    double sum = 0;
    for (int i = 0; i != kernal.size(); ++i) {
        sum += kernal[i];
    }

    for (int i = 0; i != kernal.size(); ++i) {
        kernal[i] /= sum;
    }
    return kernal;
}

Opencv uses this 0.2 * filterwidth