modified farneback sample to use T-API
This commit is contained in:
parent
0224a20ff6
commit
68305703bd
@ -37,7 +37,8 @@ int main(int, char**)
|
|||||||
if( !cap.isOpened() )
|
if( !cap.isOpened() )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
Mat prevgray, gray, flow, cflow, frame;
|
Mat flow, cflow, frame;
|
||||||
|
UMat gray, prevgray, uflow;
|
||||||
namedWindow("flow", 1);
|
namedWindow("flow", 1);
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
@ -45,10 +46,11 @@ int main(int, char**)
|
|||||||
cap >> frame;
|
cap >> frame;
|
||||||
cvtColor(frame, gray, COLOR_BGR2GRAY);
|
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);
|
cvtColor(prevgray, cflow, COLOR_GRAY2BGR);
|
||||||
|
uflow.copyTo(flow);
|
||||||
drawOptFlowMap(flow, cflow, 16, 1.5, Scalar(0, 255, 0));
|
drawOptFlowMap(flow, cflow, 16, 1.5, Scalar(0, 255, 0));
|
||||||
imshow("flow", cflow);
|
imshow("flow", cflow);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user