Commit 830ca3fb38458e36a9d11333e68fb492812fb9c6

Authored by Austin Blanton
1 parent b544cef5

Make OF parameters settable

Showing 1 changed file with 26 additions and 9 deletions
openbr/plugins/opticalflow.cpp
... ... @@ -6,22 +6,39 @@ using namespace cv;
6 6 namespace br
7 7 {
8 8  
  9 +/*!
  10 + * \ingroup transforms
  11 + * \brief Gets a two-channel dense optical flow from an image
  12 + * \author Austin Blanton \cite imaus10
  13 + */
9 14 class OpticalFlowTransform : public UntrainableTransform
10 15 {
11 16 Q_OBJECT
12   - Q_PROPERTY(QDouble pyr_scale READ get_pyr_scale WRITE set_pyr_scale RESET reset_pyr_scale STORE false)
13   - BR_PROPERTY(double, pyr_scale, 0.5)
14   - Q_PROPERTY(QString pyr_scale READ get_pyr_scale WRITE set_pyr_scale RESET reset_pyr_scale STORE false)
15   - BR_PROPERTY(double, pyr_scale, 0.5)
  17 + // these defaults are optimized for KTH
  18 + Q_PROPERTY(double pyr_scale READ get_pyr_scale WRITE set_pyr_scale RESET reset_pyr_scale STORE false)
  19 + BR_PROPERTY(double, pyr_scale, 0.1)
  20 + Q_PROPERTY(int levels READ get_levels WRITE set_levels RESET reset_levels STORE false)
  21 + BR_PROPERTY(int, levels, 1)
  22 + Q_PROPERTY(int winsize READ get_winsize WRITE set_winsize RESET reset_winsize STORE false)
  23 + BR_PROPERTY(int, winsize, 5)
  24 + Q_PROPERTY(int iterations READ get_iterations WRITE set_iterations RESET reset_iterations STORE false)
  25 + BR_PROPERTY(int, iterations, 10)
  26 + Q_PROPERTY(int poly_n READ get_poly_n WRITE set_poly_n RESET reset_poly_n STORE false)
  27 + BR_PROPERTY(int, poly_n, 7)
  28 + Q_PROPERTY(double poly_sigma READ get_poly_sigma WRITE set_poly_sigma RESET reset_poly_sigma STORE false)
  29 + BR_PROPERTY(double, poly_sigma, 1.1)
  30 + Q_PROPERTY(int flags READ get_flags WRITE set_flags RESET reset_flags STORE false)
  31 + BR_PROPERTY(int, flags, 0)
16 32  
17 33 void project(const Template &src, Template &dst) const
18 34 {
19   - // get the two images
20   - // these were the best parameters on KTH
21   - calcOpticalFlowFarneback(prevImg, nextImg, dst, 0.1, 1, 5, 10, 7, 1.1, 0);
  35 + // TODO: get the two images from AggregateFrames
  36 + calcOpticalFlowFarneback(prevImg, nextImg, dst, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags);
22 37 }
23   -}
  38 +};
  39 +
  40 +BR_REGISTER(Transform, OpticalFlowTransform)
24 41  
25 42 } // namespace br
26 43  
27   -#include
  44 +#include "opticalflow.moc"
... ...