[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
Encapsulation of direction management for the 8-neighborhood. More...
#include <vigra/pixelneighborhood.hxx>
Public Types | |
enum | Direction { Error = -1 , East = 0 , NorthEast , North , NorthWest , West , SouthWest , South , SouthEast , DirectionCount , CausalFirst = NorthEast , CausalLast = West , AntiCausalFirst = SouthWest , AntiCausalLast = East , InitialDirection = East , OppositeDirPrefix = 1 , OppositeOffset = West } |
Encapsulation of direction management for the 8-neighborhood.
This helper class allows the transformation between Freeman chain codes (East = 0, NorthEast = 1 etc.) and the corresponding Diff2D instances and back.
You can either use the chain codes by explicit qualification:
or you can fix 8-neighborhood by importing the entire namespace in your function:
If you want to pass 8-neighborhood codes as a template parameter, use the class EightNeighborhood::NeighborCode.
#include <vigra/pixelneighborhood.hxx>
Namespace: vigra::EightNeighborhood
Freeman direction codes for the 8-neighborhood. East = 0
, North = 1
etc. DirectionCount
may be used for portable loop termination conditions. CausalFirst
and CausalLast
are the first and last (inclusive) neighbors in the causal neighborhood, i.e. in the set of neighbors that have already been visited when the image is traversed in scan order. AntiCausalFirst
and AntiCausalLast
are the opposite.
Enumerator | |
---|---|
Error |
|
East |
|
NorthEast |
|
North |
|
NorthWest |
|
West |
|
SouthWest |
|
South |
|
SouthEast |
|
DirectionCount |
|
CausalFirst |
|
CausalLast |
|
AntiCausalFirst |
|
AntiCausalLast |
|
|
static |
The number of valid neighbors if the current center is at the image border.
|
static |
The valid direction codes when the center is at the image border. index must be in the range 0...nearBorderDirectionCount(b)-1
.
Transform direction code into corresponding Diff2D offset. (note: there is no bounds checking on the code you pass.)
Equivalent to diff(static_cast<Direction>(code)). (note: there is no bounds checking on the code you pass.)
Get the relative offset from one neighbor to the other. For example, relativeDiff(East, West) == Diff2D(-2,0)
. (note: there is no bounds checking on the code you pass.)
Equivalent to relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode)). (note: there is no bounds checking on the code you pass.)
|
static |
Transform 4-neighborhood code into 8-neighborhood code.
Transform Diff2D offset into corresponding direction code. The code Direction::Error
will be returned if diff
is not in the 8-neighborhood.
Check whether a code refers to a diagonal direction. Useful if you want to abstract the differences between 4- and 8-neighborhood.
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |