mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 05:06:29 +08:00
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() )
|
||||
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…
Reference in New Issue
Block a user