这是我基于OpenCV的代码:
int main()
{
clock_t start, stop;
Mat img = imread("lena.jpg", IMREAD_GRAYSCALE);
img.convertTo(img, CV_32F, 1.0);
float *imgInP = (float *)img.data; // get the input data point
Mat imgOut = Mat::zeros(Size(img.rows, img.cols), CV_32F); // create output mat
float *imgOutP = (float *)imgOutP.data; // get the output data point
// test several calling of opencv boxFilter
start = clock();
//blur(img, imgOut, Size(31, 31));
boxFilter(img, imgOut, CV_32F, Size(31, 31));
stop = clock();
cout << "BoxFilter on OpenCV 1 : " << 1000.0 * …Run Code Online (Sandbox Code Playgroud)