Commit 11c4e3a981b412848c7df204818825b676a791b8
1 parent
830ca3fb
Get the two images for OF
Showing
1 changed file
with
7 additions
and
3 deletions
openbr/plugins/opticalflow.cpp
| @@ -8,7 +8,7 @@ namespace br | @@ -8,7 +8,7 @@ namespace br | ||
| 8 | 8 | ||
| 9 | /*! | 9 | /*! |
| 10 | * \ingroup transforms | 10 | * \ingroup transforms |
| 11 | - * \brief Gets a two-channel dense optical flow from an image | 11 | + * \brief Gets a two-channel dense optical flow from two images |
| 12 | * \author Austin Blanton \cite imaus10 | 12 | * \author Austin Blanton \cite imaus10 |
| 13 | */ | 13 | */ |
| 14 | class OpticalFlowTransform : public UntrainableTransform | 14 | class OpticalFlowTransform : public UntrainableTransform |
| @@ -32,8 +32,12 @@ class OpticalFlowTransform : public UntrainableTransform | @@ -32,8 +32,12 @@ class OpticalFlowTransform : public UntrainableTransform | ||
| 32 | 32 | ||
| 33 | void project(const Template &src, Template &dst) const | 33 | void project(const Template &src, Template &dst) const |
| 34 | { | 34 | { |
| 35 | - // TODO: get the two images from AggregateFrames | ||
| 36 | - calcOpticalFlowFarneback(prevImg, nextImg, dst, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags); | 35 | + // get the two images put there by AggregateFrames |
| 36 | + Mat prevImg = src[0]; | ||
| 37 | + Mat nextImg = src[1]; | ||
| 38 | + Mat flow; | ||
| 39 | + calcOpticalFlowFarneback(prevImg, nextImg, flow, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags); | ||
| 40 | + dst += flow; | ||
| 37 | } | 41 | } |
| 38 | }; | 42 | }; |
| 39 | 43 |