25 #ifndef __CONTOURDETECTORSIMPLE_HH__
26 #define __CONTOURDETECTORSIMPLE_HH__
32 #include <Base/Image/Image.hh>
33 #include <Base/Math/Vector2.hh>
34 #include "ContourDetectorBase.hh"
44 template <
class StorageType>
64 std::vector<BIAS::BIASContour>& contour);
114 { background_=backgroundColor;}
157 StorageType pixel = data_[y][x];
158 return !( pixel == background_ );
168 inline bool IsFg_(
int x,
int y,
int direction) {
169 switch ( (direction+16)%8 ) {
170 case 0:
return IsFg_(x+1,y+0);
171 case 2:
return IsFg_(x+0,y+1);
172 case 4:
return IsFg_(x-1,y+0);
173 case 6:
return IsFg_(x+0,y-1);
174 case 1:
return IsFg_(x+1,y+1);
175 case 3:
return IsFg_(x-1,y+1);
176 case 5:
return IsFg_(x-1,y-1);
177 case 7:
return IsFg_(x+1,y-1);
190 bool FindFirst_(
int &pos_x,
int &pos_y);
202 template <
class StorageType>
210 StorageType
Get(
int row,
int col);
211 void Set(
int row,
int col, StorageType value);
220 #endif //__CONTOURDETECTORSIMPLE_HH__
T * Get(SharedPtr< T > &t)
This class describes a contour using the freemancode.
std::vector< int > directionList_
std::vector< int > & GetFreemanCode()
instead of contour pixels a start point and a list of difference vector (created during surrounding t...
a class for calculating the contour of a segmented region
bool IsFg_(int x, int y)
determines of a pixel is foreground or not
The image template class for specific storage types.
void SetBackground(StorageType backgroundColor)
Set the background color if it is different from 0.
bool IsFg_(int x, int y, int direction)
returns IsFg_ of the next pixel in the direction of param direction
void SetGap(int gap=5)
Set the maximum gap which is bridged in search for contour.
purely virtual interface defining class for contour detectors