1 #include <opencv2/opencv.hpp> 2 #include <iostream> 3 #include "math.h" 4 5 using namespace cv; 6 using namespace std; 7 8 int main(int argc, char** argv) { 9 Mat src = imread("test.jpg",0); 10 if (src.empty()) { 11 printf("could not load image...\n"); 12 return -1; 13 } 14 imshow("input image", src); 15 16 //计算积分图 17 Mat sumii = Mat::zeros(src.rows+1,src.cols+1,CV_32FC1);//CV_32FC1防止溢出 18 Mat sqsumii = Mat::zeros(src.rows + 1, src.cols + 1, CV_32FC1);//CV_32FC1防止溢出 19 integral(src,sumii,sqsumii); 20 21 normalize(sumii, sumii,0,255,NORM_MINMAX,CV_8UC1,Mat()); 22 imshow("integral image", sumii); 23 24 waitKey(0); 25 return 0; 26 }
原文地址:https://www.cnblogs.com/long5683/p/9738104.html
时间: 2024-11-02 18:03:20