Loading...
Searching...
No Matches
CommandOpticalFlow.h
1/*
2
3MIT License
4
5Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26/*
27Part of Rack development has been done in the BALTRAD projects part-financed
28by the European Union (European Regional Development Fund and European
29Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30*/
31
32#ifndef COMMAND_OFLOW_H_
33#define COMMAND_OFLOW_H_
34
35//#include "CommandRegistry.h"
36//#include <drain/prog/CommandInstaller.h>
37#include "drain/prog/Command.h"
38#include "drain/imageops/FastOpticalFlowOp2.h"
39
40
41namespace drain {
42
43using namespace image;
44
45
46
48
55class CmdOpticalFlowBase : public BeanCommand<FastOpticalFlow2Op> {
56
57public:
58
59 /*
60 CmdOpticalFlowBase() {
61 //bean.parameters.link("smoothing", smoothing="doubleSmoother:coeff=0.95", "imageOp");
62 //average,gaussianAverage,distanceTransformFill
63 }
64 */
65
66 /*
67 CmdOpticalFlowBase(const CmdOpticalFlowBase & cmd) {
68 //bean.parameters.copyStruct(cmd.getParameters(), cmd, *this);
69 }
70 */
71
73 void exec() const;
74
76 // void compute(const ImageTray<const Channel> & src, ImageTray<Channel> & diff, ImageTray<Channel> & motion) const;
77
78protected:
79
80
82
86 virtual
87 const AreaGeometry & getGeometry() const = 0;
88
89
91 virtual
92 void getSrcData(ImageTray<const Channel> & channels) const = 0;
93
94
96
105 virtual
106 void getDiff(size_t width, size_t height, double max, ImageTray<Channel> & channels) const;
107
108
110 virtual
111 void getMotion(size_t width, size_t height, ImageTray<Channel> & channels) const = 0;
112
113 void debugChannels(const ImageTray<const Channel> & channels, int i=-1, int j=-1) const;
114
115};
116
117
118} /* namespace drain */
119
120#endif /* DRAINLET_H_ */
121
122// Rack
Retrieves bean dynamically for each call.
Definition Command.h:328
Utility for creating a Command that runs FastOpticalFlowOp operator.
Definition CommandOpticalFlow.h:55
virtual const AreaGeometry & getGeometry() const =0
Main operation: computes differentials and produces approximation of motion.
virtual void getDiff(size_t width, size_t height, double max, ImageTray< Channel > &channels) const
Retrieves the difference image needed as a temporary storage. Maybe viewed for debugging.
Definition CommandOpticalFlow.cpp:45
virtual void getMotion(size_t width, size_t height, ImageTray< Channel > &channels) const =0
The result is stored in this channel pack.
void exec() const
Main operation: computes differentials and produces approximation of motion.
Definition CommandOpticalFlow.cpp:101
virtual void getSrcData(ImageTray< const Channel > &channels) const =0
Retrieves the intensity images used as a basis of motion analysis.
Container applicable for Channels and Images, with alpha support.
Definition ImageTray.h:266
Definition DataSelector.cpp:1277