这个是我用暴力生成的一个高斯滤波的函数，但是我觉得这个效率不高，你能够用行列分离的方式进行优化吗？或者按照你自己的想法来优化这段代码，使得其时间复杂度降低。
void GaussianFilter_1(const cv::Mat &src,cv::Mat &dst,int ksize,double sigma) {
	assert(src.channels() || src.channels() == 3); //仅仅处理单通道图像
	if (ksize > MAX_KSIZE) { std::cout << "kszie is too big! Smaller!" << std::endl; return; }
	
	clock_t time_beg = clock();
	clock_t time_end = 0;
	//申请一个二维数组用于存放生成的高斯模版矩阵
	//根据 ksize 生成一个 [ksize,ksize] Matrix
	double** templateMatrix = new double* [ksize];
	for (int i = 0; i < ksize; i++) { templateMatrix[i] = new double[ksize]; }

	GenerateGaussianTemplate2D(templateMatrix,ksize,sigma);

	//将模板应用到图像当中： 
	int border = ksize / 2;   //3->1  5->2
	//将src拷贝到dst并且使用 cv::BorderType::BORDER_REFLECT 进行边界的扩充
	copyMakeBorder(src, dst, border, border, border, border, cv::BorderTypes::BORDER_REFLECT);
	
	int channels = dst.channels();
	int rows = dst.rows - border;
	int cols = dst.cols - border;
	for (int i = border; i < rows; i++) { //Range : [border,rows-border]
		for (int j = border; j < cols; j++) {
			double sum[3] = { 0 };
			for (int a = -border; a <= border; a++){ //Matrix[2*border,2*border]
				for (int b = -border; b <= border; b++){
					if (channels == 1)
						{ sum[0] += templateMatrix[border + a][border + b] * dst.at<uchar>(i + a, j + b); }
					else if (channels == 3) {
						cv::Vec3b rgb = dst.at<cv::Vec3b>(i + a, j + b);
						double k = templateMatrix[border + a][border + b];
						sum[0] += k * rgb[0];
						sum[1] += k * rgb[1];
						sum[2] += k * rgb[2];
					}
				}
			}
			//在应用高斯模板之后可能存在小于或者大于255的像素值，将其限制到[0,255]
			for (int k = 0; k < channels; k++){  
				if (sum[k] < 0)
					sum[k] = 0;
				else if (sum[k] > 255)
					sum[k] = 255;
			}
			if (channels == 1)
				dst.at<uchar>(i, j) = static_cast<uchar>(sum[0]);
			else if (channels == 3){
				cv::Vec3b rgb = { static_cast<uchar>(sum[0]), static_cast<uchar>(sum[1]), static_cast<uchar>(sum[2]) };
				dst.at<cv::Vec3b>(i, j) = rgb;
			}
		}
	}
	// 释放模板数组
	for (int i = 0; i < ksize; i++)
		delete[] templateMatrix[i];
	delete[] templateMatrix;

	time_end = clock();
	std::cout << "Gaissian blur 1 spend time : " << time_end - time_beg << std::endl; 
}
