modified farneback sample to use T-API

pull/3066/head
Vadim Pisarevsky 10 years ago
parent 0224a20ff6
commit 68305703bd
  1. 8
      samples/cpp/fback.cpp

@ -37,7 +37,8 @@ int main(int, char**)
if( !cap.isOpened() )
return -1;
Mat prevgray, gray, flow, cflow, frame;
Mat flow, cflow, frame;
UMat gray, prevgray, uflow;
namedWindow("flow", 1);
for(;;)
@ -45,10 +46,11 @@ int main(int, char**)
cap >> frame;
cvtColor(frame, gray, COLOR_BGR2GRAY);
if( prevgray.data )
if( !prevgray.empty() )
{
calcOpticalFlowFarneback(prevgray, gray, flow, 0.5, 3, 15, 3, 5, 1.2, 0);
calcOpticalFlowFarneback(prevgray, gray, uflow, 0.5, 3, 15, 3, 5, 1.2, 0);
cvtColor(prevgray, cflow, COLOR_GRAY2BGR);
uflow.copyTo(flow);
drawOptFlowMap(flow, cflow, 16, 1.5, Scalar(0, 255, 0));
imshow("flow", cflow);
}

Loading…
Cancel
Save