OpenCV——積分圖計算
阿新 • • 發佈:2018-10-03
col com stream image using alt pan not sqs
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"); 12return -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 }
OpenCV——積分圖計算