revamped
This commit is contained in:
parent
8dd8583596
commit
05f45a3b95
@ -2,8 +2,20 @@
|
|||||||
#include <opencv2/imgproc/imgproc.hpp>
|
#include <opencv2/imgproc/imgproc.hpp>
|
||||||
#include <opencv2/highgui/highgui.hpp>
|
#include <opencv2/highgui/highgui.hpp>
|
||||||
|
|
||||||
using namespace cv;
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace cv;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void help()
|
||||||
|
{
|
||||||
|
cout <<
|
||||||
|
"\nThis program demonstrates dense, Farnback, optical flow\n"
|
||||||
|
"Mainly the function: calcOpticalFlowFarneback()\n"
|
||||||
|
"Call:\n"
|
||||||
|
"./fback\n"
|
||||||
|
"This reads from video camera 0\n" << endl;
|
||||||
|
}
|
||||||
void drawOptFlowMap(const Mat& flow, Mat& cflowmap, int step,
|
void drawOptFlowMap(const Mat& flow, Mat& cflowmap, int step,
|
||||||
double, const Scalar& color)
|
double, const Scalar& color)
|
||||||
{
|
{
|
||||||
@ -20,7 +32,7 @@ void drawOptFlowMap(const Mat& flow, Mat& cflowmap, int step,
|
|||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
{
|
{
|
||||||
VideoCapture cap(0);
|
VideoCapture cap(0);
|
||||||
|
help();
|
||||||
if( !cap.isOpened() )
|
if( !cap.isOpened() )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -34,7 +46,7 @@ int main(int, char**)
|
|||||||
|
|
||||||
if( prevgray.data )
|
if( prevgray.data )
|
||||||
{
|
{
|
||||||
calcOpticalFlowFarneback(prevgray, gray, flow, 0.5, 3, 15, 3, 5, 1.2, 0);
|
(prevgray, gray, flow, 0.5, 3, 15, 3, 5, 1.2, 0);
|
||||||
cvtColor(prevgray, cflow, CV_GRAY2BGR);
|
cvtColor(prevgray, cflow, CV_GRAY2BGR);
|
||||||
drawOptFlowMap(flow, cflow, 16, 1.5, CV_RGB(0, 255, 0));
|
drawOptFlowMap(flow, cflow, 16, 1.5, CV_RGB(0, 255, 0));
|
||||||
imshow("flow", cflow);
|
imshow("flow", cflow);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user