Пример #1
0
void Builder::showOpticalFlow(FramePtr const& frame, cv::Scalar const& color, cv::Mat & img){
	cv::Point2f pt;
	VideoLib::Frame::Features& features = frame->features();
	for(int i = 0; i < img.rows; i+=10){
		for(int j = 0; j<img.cols; j+=10){
			pt = features.at<cv::Point2f>(i,j);
			if(pt.x != 0 && pt.y !=0){
				cv::line(img,cv::Point2f(i,j),cv::Point2f(i+pt.x,j+pt.y), color,1);
				//cv::circle(img, cv::Point(i,j), 2, color, -1);
			}
		}
	}

}