Commit e6bc189e284a10b26e0da8be9fe2f2460ff9847b
1 parent
588bee16
Make AggregateFrames operate over TemplateLists (downstream independent Transfor…
…ms were receiving empty Templates)
Showing
2 changed files
with
6 additions
and
4 deletions
openbr/plugins/frames.cpp
| @@ -27,12 +27,14 @@ private: | @@ -27,12 +27,14 @@ private: | ||
| 27 | (void) data; | 27 | (void) data; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | - void projectUpdate(const Template &src, Template &dst) | 30 | + void projectUpdate(const TemplateList &src, TemplateList &dst) |
| 31 | { | 31 | { |
| 32 | buffer.append(src); | 32 | buffer.append(src); |
| 33 | if (buffer.size() < n) return; | 33 | if (buffer.size() < n) return; |
| 34 | - foreach (const Template &t, buffer) dst.append(t); | ||
| 35 | - dst.file = buffer.takeFirst().file; | 34 | + Template out; |
| 35 | + foreach (const Template &t, buffer) out.append(t); | ||
| 36 | + out.file = buffer.takeFirst().file; | ||
| 37 | + dst.append(out); | ||
| 36 | } | 38 | } |
| 37 | 39 | ||
| 38 | void finalize(TemplateList & output) | 40 | void finalize(TemplateList & output) |
openbr/plugins/opticalflow.cpp
| @@ -34,7 +34,7 @@ class OpticalFlowTransform : public UntrainableMetaTransform | @@ -34,7 +34,7 @@ class OpticalFlowTransform : public UntrainableMetaTransform | ||
| 34 | void project(const Template &src, Template &dst) const | 34 | void project(const Template &src, Template &dst) const |
| 35 | { | 35 | { |
| 36 | // get the two images put there by AggregateFrames | 36 | // get the two images put there by AggregateFrames |
| 37 | - if (src.size() < 2) return; | 37 | + if (src.size() != 2) qFatal("Optical Flow requires two images."); |
| 38 | Mat prevImg = src[0], nextImg = src[1], flow, flowOneCh; | 38 | Mat prevImg = src[0], nextImg = src[1], flow, flowOneCh; |
| 39 | if (src[0].channels() != 1) OpenCVUtils::cvtGray(src[0], prevImg); | 39 | if (src[0].channels() != 1) OpenCVUtils::cvtGray(src[0], prevImg); |
| 40 | if (src[1].channels() != 1) OpenCVUtils::cvtGray(src[1], nextImg); | 40 | if (src[1].channels() != 1) OpenCVUtils::cvtGray(src[1], nextImg); |