#include #include #include #include #include #include int main(void) { // Load the prev image cv::Mat prev = cv::imread("blocks1.png", 1); if(prev.empty()) return -1; // Load the next image cv::Mat next = cv::imread("blocks2.png", 1); if(next.empty()) return -1; std::vector prev_pts; std::vector next_pts; // Initialize cv::Size flowSize(30,30); cv::Point2f center = cv::Point(prev.cols/2., prev.rows/2.); for(int i=0; i::const_iterator p = prev_pts.begin(); std::vector::const_iterator n = next_pts.begin(); for(; n!=next_pts.end(); ++n,++p) { cv::line(prev, *p, *n, cv::Scalar(150,0,0),2); } cv::namedWindow("optical flow", CV_WINDOW_AUTOSIZE|CV_WINDOW_FREERATIO); cv::imshow("optical flow", prev); cv::waitKey(0); */ return 0; // The heap error occurs after the end of main function. }