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/FastOpticalFlowOp.h"
39#include "drain/imageops/FastOpticalFlowOp2.h"
40#include "drain/imageops/BlenderOp.h"
41
42
43namespace drain {
44
45using namespace image;
46
47
48
50
57class CmdOpticalFlowBase : public BeanCommand<FastOpticalFlow2Op> {
58
59public:
60
61 /*
62 CmdOpticalFlowBase() {
63 //bean.parameters.link("smoothing", smoothing="doubleSmoother:coeff=0.95", "imageOp");
64 //average,gaussianAverage,distanceTransformFill
65 }
66 */
67
68 /*
69 CmdOpticalFlowBase(const CmdOpticalFlowBase & cmd) {
70 //bean.parameters.copyStruct(cmd.getParameters(), cmd, *this);
71 }
72 */
73
75 void exec() const;
76
78 // void compute(const ImageTray<const Channel> & src, ImageTray<Channel> & diff, ImageTray<Channel> & motion) const;
79
80protected:
81
82
84
88 virtual
89 const AreaGeometry & getGeometry() const = 0;
90
91
93 virtual
94 void getSrcData(ImageTray<const Channel> & channels) const = 0;
95
96
98
107 virtual
108 void getDiff(size_t width, size_t height, double max, ImageTray<Channel> & channels) const;
109
110
112 virtual
113 void getMotion(size_t width, size_t height, ImageTray<Channel> & channels) const = 0;
114
115 void debugChannels(const ImageTray<const Channel> & channels, int i=-1, int j=-1) const;
116
117};
118
119
120} /* namespace drain */
121
122#endif /* DRAINLET_H_ */
123
124// Rack
Retrieves bean dynamically for each call.
Definition Command.h:309
Utility for creating a Command that runs FastOpticalFlowOp operator.
Definition CommandOpticalFlow.h:57
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:267
Definition DataSelector.cpp:1277