![]() |
|
Window implementation that uses incremental update of state. More...
#include <SlidingWindow.h>
Public Member Functions | |
SlidingWindow (int width=0, int height=0, bool horzMultiple=true, bool vertMultiple=true) | |
SlidingWindow (const C &conf, bool horzMultiple=true, bool vertMultiple=true) | |
void | setSlidingMode (bool horzMultiple, bool vertMultiple) |
void | run () |
Sets coord handler, calls initialise, sets pos(0,0), fills, writes and slides. | |
void | runHorz () |
Sets coord handler, calls initialise, sets pos(0,0), fills, writes and slides. | |
void | runVert () |
Sets coord handler, calls initialise, sets pos(0,0), fills, writes and slides. | |
virtual void | debug () |
virtual void | write ()=0 |
Write the result in the target image. | |
const std::string & | getModeStr () |
![]() | |
Window (size_t width=1, size_t height=0) | |
Constructor with geometry setting option. | |
Window (const C &conf) | |
Constructor adapting given configuration. | |
Window (const Window &window) | |
virtual | ~Window () |
Destructor. | |
virtual void | setSize (size_t width, size_t height) |
Sets the window size. | |
size_t | getArea () |
Returns the nominal area in pixels. | |
size_t | getSamplingArea () |
Returns the area which has eventually been scaled (in a non-linear coordinate system) | |
virtual void | toStream (std::ostream &ostr) const |
![]() | |
virtual void | setSrcFrames (const ImageTray< const Channel > &srcTray) |
virtual void | setDstFrames (ImageTray< Channel > &dstTray) |
virtual void | setSrcFrameWeight (const ImageFrame &srcW) |
virtual void | setDstFrameWeight (ImageFrame &dstW) |
![]() | |
virtual void | setSrcFrame (const ImageFrame &src) |
virtual void | setDstFrame (ImageFrame &dst) |
Protected Member Functions | |
virtual void | initialize ()=0 |
Sets class-specific initial values. Does not change general window state (e.g. location). Should not accumulate any statistics. | |
virtual bool | reset () |
Returns false, if traversal should be ended. | |
void | slideHorz () |
High-level functionality of a sliding window. FINAL. | |
void | slideVert () |
High-level functionality of a sliding window. FINAL. | |
bool | moveDown () |
Moves one pixel down. Stops at the edge, and returns false. | |
bool | moveUp () |
Moves one pixel up. Stops at the edge, and returns false. | |
bool | moveRight () |
Moves one pixel right. Stops at the edge, and returns false. | |
bool | moveLeft () |
Moves one pixel left. Stops at the edge, and returns false. | |
virtual void | clear () |
Clears the applied statistics. Redefined in derived classes. | |
virtual void | fillBoth () |
Clears and computes the statistics for the current location. | |
void | fillHorz () |
Clears and computes the statistics for the current location. FINAL. | |
void | fillVert () |
Clears and computes the statistics for the current location. FINAL. | |
void | updateHorzMultiple () |
In moving horizontally, updates the window centered at current location. Calls removePixel() and addPixel(). | |
void | updateHorzSingle () |
void | updateVertMultiple () |
In moving vertically, updates the window centered at current location. Calls removePixel() and addPixel(). | |
void | updateVertSingle () |
For 1 x n sized windows. | |
virtual void | addPixel (Point2D< int > &p)=0 |
Adds a pixel to window statistics. Unvalidated location. | |
virtual void | removePixel (Point2D< int > &p)=0 |
Removes a pixel from window statistics. Unvalidated location. | |
![]() | |
virtual bool | isHorizontal () const |
Tells if the window should be moved (traversed of slided) row-by-row (horizontally) or column-by-column (vertically). | |
virtual void | update () |
At each location, this is called to calculate and store something in members. | |
virtual void | setImageLimits () const =0 |
Sets internal limits corresponding to image geometries. Typically using coordHandler. | |
virtual void | setLoopLimits (int width, int height) |
Sets the actual traversal range inside the window. Sometimes applied dynamically by reset(). | |
void | setLoopLimits () |
Sets the actual traversal range inside the window. Sometimes applied dynamically by reset(). | |
bool | debugDiag (int bit=4) |
Protected Attributes | |
Point2D< int > | locationLead |
Point2D< int > | locationTrail |
void(SlidingWindow< C, R >::* | fill )() |
Pointer to fill operation preformed at initial location (0,0) | |
void(SlidingWindow< C, R >::* | updateHorz )() |
Pointer to update function invoked at each horizontal move. | |
void(SlidingWindow< C, R >::* | updateVert )() |
Pointer to update function invoked at each vertical move. | |
Point2D< int > | locationTmp |
![]() | |
Point2D< int > | location |
Current location of this window. | |
int | samplingArea = 0 |
Number of pixels in the window (frame width*height?). | |
bool | resetAtEdges = false |
To avoid accumulated numerical errors esp. with floats, reset the statistics at row/cols ends. See reset() . | |
bool | SCALE = true |
If set, scaling is applied, potentially slowering the computation. | |
Range< int > | iRange |
Studies source and destination images and decides whether scaling (SCALE=true) should be set. | |
Range< int > | jRange |
CoordinateHandler2D | coordinateHandler |
Additional Inherited Members | |
![]() | |
typedef C | conf_t |
![]() | |
conf_t | conf |
UniCloner< UnaryFunctor > | unicloner |
drain::UnaryFunctor & | myFunctor |
![]() | |
ImageView | src |
ImageView | dst |
Window implementation that uses incremental update of state.
WindowConfig | |
WindowConfig |
|
inline |
|
protectedpure virtual |
Adds a pixel to window statistics. Unvalidated location.
Updates class-specific window statistics by adding a pixel value - typically at the leading edge of the window.
p | - location at which contribution should be removed |
The argument p is not validated in advance but it should be checked within the implementation using coordinateHandler.validate(p), for example.
Implemented in DopplerInversionWindow, SlidingRadarWindow< C, R >, SlidingRadarWindow< DopplerInversionConfig >, SlidingRadarWindow< F >, SlidingRadarWindow< RadarWindowConfig >, RadarWindowWeightedAvg< C >, Etop2Window, SlidingOpticalFlow< R >, SlidingOpticalFlow< OpticalFlowCore1 >, SlidingOpticalFlowWeighted, SlidingOpticalFlow2< R >, SlidingOpticalFlow2< OpticalFlowCore2 >, SlidingOpticalFlowWeighted2, FlowAverageWindow, FlowAverageWindowWeighted, SlidingWindowHistogram< R >, SlidingWindowHistogram< WeightedWindowCore >, SlidingWindowHistogram< WindowCore >, and SlidingWindowHistogramWeighted.
|
inlineprotectedvirtual |
Clears the applied statistics. Redefined in derived classes.
Reimplemented in SlidingOpticalFlow< R >, SlidingOpticalFlow< OpticalFlowCore1 >, SlidingOpticalFlow2< R >, SlidingOpticalFlow2< OpticalFlowCore2 >, FlowAverageWindow, SlidingWindowHistogram< R >, SlidingWindowHistogram< WeightedWindowCore >, SlidingWindowHistogram< WindowCore >, DopplerWindow, DopplerInversionWindow, RadarWindowAvg< C >, RadarWindowSoftMax< C >, RadarWindowStdDev< F >, and RadarWindowWeightedAvg< C >.
|
inlineprotectedvirtual |
Clears and computes the statistics for the current location.
Initialises the statistics in the current locationv.W
|
inlineprotected |
Clears and computes the statistics for the current location. FINAL.
Note: the direction (horz) describes the orientation of the window stripe, not the direction of motion.
|
inlineprotected |
Clears and computes the statistics for the current location. FINAL.
Note: the direction (vert) describes the orientation of the window stripe, not the direction of motion.
|
protectedpure virtual |
Sets class-specific initial values. Does not change general window state (e.g. location). Should not accumulate any statistics.
Reimplemented from Window< C, R >.
Implemented in SlidingOpticalFlow< R >, SlidingOpticalFlow< OpticalFlowCore1 >, SlidingOpticalFlow2< R >, SlidingOpticalFlow2< OpticalFlowCore2 >, FlowAverageWindow, SlidingWindowHistogram< R >, SlidingWindowHistogram< WeightedWindowCore >, SlidingWindowHistogram< WindowCore >, DopplerWindow, DopplerInversionWindow, Etop2Window, SlidingRadarWindowBase< C, R >, SlidingRadarWindowBase< C, RadarWindowCore >, SlidingRadarWindowBase< DopplerInversionConfig, RadarWindowCore >, SlidingRadarWindowBase< F, RadarWindowCore >, and SlidingRadarWindowBase< RadarWindowConfig, RadarWindowCore >.
|
inlineprotected |
Moves one pixel down. Stops at the edge, and returns false.
High-level functionality of a sliding window.
|
inlineprotected |
Moves one pixel left. Stops at the edge, and returns false.
High-level functionality of a sliding window.
|
inlineprotected |
Moves one pixel right. Stops at the edge, and returns false.
High-level functionality of a sliding window.
|
inlineprotected |
Moves one pixel up. Stops at the edge, and returns false.
High-level functionality of a sliding window.
|
protectedpure virtual |
Removes a pixel from window statistics. Unvalidated location.
Updates class-specific window statistics by removing a pixel value - typically at the trailing edge of the window. \param p - location at which contribution should be removed const int h = (conf.height>0.0) ? conf.height : conf.width;
GaussianStripeVert window2(h, 0.5*conf.radius*static_cast{double}(h)); GaussianStripe2<false> window2(h, 0.5*conf.radius*static_cast{double}(h));
The argument p is \em not validated in advance but it should be checked within the implementation using coordinateHandler.validate(p), for example.
Implemented in DopplerInversionWindow, SlidingRadarWindow< C, R >, SlidingRadarWindow< DopplerInversionConfig >, SlidingRadarWindow< F >, SlidingRadarWindow< RadarWindowConfig >, RadarWindowWeightedAvg< C >, Etop2Window, SlidingOpticalFlow< R >, SlidingOpticalFlow< OpticalFlowCore1 >, SlidingOpticalFlowWeighted, SlidingOpticalFlow2< R >, SlidingOpticalFlow2< OpticalFlowCore2 >, SlidingOpticalFlowWeighted2, FlowAverageWindow, FlowAverageWindowWeighted, SlidingWindowHistogram< R >, SlidingWindowHistogram< WeightedWindowCore >, SlidingWindowHistogram< WindowCore >, and SlidingWindowHistogramWeighted.
|
inlineprotectedvirtual |
Returns false, if traversal should be ended.
Reimplemented from Window< C, R >.
Reimplemented in SlidingRadarWindowBase< C, R >, SlidingRadarWindowBase< C, RadarWindowCore >, SlidingRadarWindowBase< DopplerInversionConfig, RadarWindowCore >, SlidingRadarWindowBase< F, RadarWindowCore >, and SlidingRadarWindowBase< RadarWindowConfig, RadarWindowCore >.
|
inlinevirtual |
Sets coord handler, calls initialise, sets pos(0,0), fills, writes and slides.
Notice that this top-level function is final.
if (this->isHorizontal()){ runHorz(); } else { runVert(); }
Reimplemented from Window< C, R >.
|
inline |
Sets coord handler, calls initialise, sets pos(0,0), fills, writes and slides.
Notice that this top-level function is FINAL.
|
inline |
Sets coord handler, calls initialise, sets pos(0,0), fills, writes and slides.
Notice that this top-level function is FINAL.
|
pure virtual |
Write the result in the target image.
Sliding windows enjoys a confidence of the application, as it has the
Implements Window< C, R >.
Implemented in SlidingOpticalFlow< R >, SlidingOpticalFlow< OpticalFlowCore1 >, SlidingOpticalFlow2< R >, SlidingOpticalFlow2< OpticalFlowCore2 >, FlowAverageWindow, FlowAverageWindowWeighted, SlidingWindowHistogram< R >, SlidingWindowHistogram< WeightedWindowCore >, SlidingWindowHistogram< WindowCore >, SlidingWindowHistogramWeighted, SlidingWindowMedian, SlidingWindowMedianWeighted, DopplerAverageWindow, DopplerAverageWindow2, DopplerDevWindow, DopplerEccentricityWindow, DopplerInversionWindow, RadarWindowAvg< C >, RadarWindowSoftMax< C >, RadarWindowStdDev< F >, Etop2Window, and RadarWindowWeightedAvg< C >.
|
protected |
Pointer to fill operation preformed at initial location (0,0)
Initially set to fillMultiple()
|
protected |
Pointer to update function invoked at each horizontal move.
Note: the direction (horz) describes window motion, not the orientation of the window stripe. Only a single element may be handled, like in the case of FastAvergaeOp ( SlidingWindowStripe ).
Initially set to updateHorzMultiple()
|
protected |
Pointer to update function invoked at each vertical move.
Note: the direction (vert) describes window motion, not the orientation of the window stripe. Only a single element may be handled, like in the case of FastAvergaeOp ( SlidingWindowStripe ).
Initially set to updateVertMultiple()