Basic Image AlgorithmS Library
2.8.0
|
Canny edge detector. More...
#include <Filter/CannyEdge.hh>
Public Types | |
enum | TBorderHandling { TBH_full, TBH_same, TBH_valid } |
enum for border calculation, same meanings as in matlab: More... | |
Public Member Functions | |
void | AddDebugLevel (const long int lv) |
void | AddDebugLevel (const std::string &name) |
CannyEdge () | |
Constructor, setting default values. More... | |
virtual CannyEdge < InputStorageType, OutputStorageType > * | Clone () const |
get copy of this filter More... | |
void | CopyNonROIFromSource (const Image< InputStorageType > &src, Image< OutputStorageType > &dst) const |
run over all pixel which do not belong to the roi and set them to the value in the source image regardless of the roi of the source. More... | |
bool | DebugLevelIsSet (const long int lv) const |
bool | DebugLevelIsSet (const std::string &name) const |
virtual int | Filter (const Image< InputStorageType > &src, Image< OutputStorageType > &gx, Image< OutputStorageType > &gy, Image< OutputStorageType > &magnitude, Image< OutputStorageType > &gdir, Image< OutputStorageType > &dst) |
call for getting all intermediary results More... | |
virtual int | Filter (const Image< InputStorageType > &src, Image< OutputStorageType > &dst) |
call for only getting the (binary) edge image More... | |
int | GetBorderHandling () const |
void | GetBorders (int &border_x, int &border_y) const |
virtual void | GetBordersValid_ (int &border_x, int &border_y) const |
not implemented More... | |
int | GetDebugLevel () const |
std::ostream & | GetDebugStream () const |
void | GetDebugStream (std::ostream &os) const |
long int | Name2DebugLevel (const std::string &name) const |
looks up a debuglevel in the internal map, returns 0 if not found More... | |
long int | NewDebugLevel (const std::string &name) |
creates a new debuglevel More... | |
void | PrintDebugLevel (std::ostream &os=std::cout) const |
void | RemoveDebugLevel (const long int lv) |
void | RemoveDebugLevel (const std::string &name) |
void | SetBorderHandling (const int bh) |
void | SetDebugLevel (const long int lv) |
void | SetDebugLevel (const std::string &name) |
void | SetDebugStream (const std::ostream &os) |
int | SetEdgeWidth (unsigned int edgeWidth) |
set edge width for hysteresis. More... | |
int | SetGaussSigma (float sigma) |
before edge detection, the input image is blurred with a gaussian. Set sigma here (defaults to 1.4) More... | |
void | SetNonROIToValue (Image< OutputStorageType > &dst, const std::vector< OutputStorageType > &t) const |
run over all pixel which do not belong to the roi and set them to some value (typically black) More... | |
int | SetThresholdsAbsolute (OutputStorageType lowAbs_, OutputStorageType highAbs_) |
set absolute value of low and high thresholds for hysteresis in magnitude gradient image More... | |
int | SetThresholdsRelative (unsigned int low_, unsigned int high_) |
set value of low and high thresholds for hysteresis in magnitude gradient image in terms of percent of image pixels More... | |
void | ShowDebugLevel (std::ostream &os=std::cout) const |
prints all internally known debuglevels More... | |
virtual | ~CannyEdge () |
Static Public Member Functions | |
static long int | GetGlobalDebugLevel () |
static void | SetGlobalDebugLevel (long int lev) |
Protected Member Functions | |
int | CalculateGradients_ (const Image< OutputStorageType > &src, Image< OutputStorageType > &gx, Image< OutputStorageType > &gy, Image< OutputStorageType > &magnitude, Image< OutputStorageType > &gdir, Image< OutputStorageType > &dst) |
long | ConsumeNextFreeDebuglevel_ () |
returns the next available debuglevel More... | |
int | DetermineThresholds_ (const Image< OutputStorageType > &src, OutputStorageType &low, OutputStorageType &high) |
int | SmoothImage_ (const Image< InputStorageType > &src, Image< OutputStorageType > &smoothed) |
Protected Attributes | |
int | _FilterBorderHandling |
long int | _liDebugLevel |
long int | _liNextDebugLevel |
new concept, debuglevel are managed here in the debug class More... | |
std::map< std::string, long int > | _String2Debuglevel |
Convolution< OutputStorageType, OutputStorageType > | ConvX_ |
Convolution< OutputStorageType, OutputStorageType > | ConvY_ |
Static Protected Attributes | |
static std::ostream | _zDebugStream |
static long int | GlobalDebugLevel = 0 |
Canny edge detector.
uses gradient calculation on upsampled images
Low and High thresholds for hysteresis can either be set manually or be determined by histogram segmentation.
For the latter, use SetThresholdsRelative(low, high) to set the number of pixels in percent in the magnitude image to not
be evaluated by hysteresis. Per default, the lowest 60 percent of all pixels define the lower threshold and the upper 10 percent
of all pixels define the higher threshold.
Implementation follows the online tutorial of http://www.pages.drexel.edu/~weg22/can_tut.html closely.
Only tested for InputStorageType unsigned char, OutputStorageType float!
Definition at line 48 of file CannyEdge.hh.
|
inherited |
enum for border calculation, same meanings as in matlab:
Enumerator | |
---|---|
TBH_full | |
TBH_same | |
TBH_valid |
Definition at line 98 of file FilterBase.hh.
BIAS::CannyEdge< InputStorageType, OutputStorageType >::CannyEdge | ( | ) |
Constructor, setting default values.
Definition at line 31 of file CannyEdge.cpp.
|
virtual |
Definition at line 54 of file CannyEdge.cpp.
|
inlineinherited |
Definition at line 355 of file Debug.hh.
Referenced by BIAS::GLProjectionParametersBase::AddDebugLevel(), BIAS::Triangulation::CorrectCorrespondences(), BIAS::FilterBase< InputStorageType, OutputStorageType >::FilterBase(), BIAS::ShowCamWxVideoSourceFactory::OpenDevice(), and BIAS::SceneOpenSceneGraph::SceneOpenSceneGraph().
|
inlineinherited |
|
protected |
Definition at line 115 of file CannyEdge.cpp.
References BIAS::Image< StorageType >::GetImageDataArray(), and BIAS::Image< StorageType >::Init().
|
inlinevirtual |
get copy of this filter
Definition at line 69 of file CannyEdge.hh.
|
inlineprotectedinherited |
|
inherited |
run over all pixel which do not belong to the roi and set them to the value in the source image regardless of the roi of the source.
Both images must have same size.
Definition at line 135 of file FilterBase.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ROI::GetCorners(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetROI(), BIAS::ImageBase::GetWidth(), and BIAS::ROI_Corners.
|
inlineinherited |
Definition at line 341 of file Debug.hh.
Referenced by BIAS::GenSynthMatches::_AddUniformDistributedOutliers(), BIAS::GenSynthMatches::_CreateCamMovement(), BIAS::GenSynthMatches::_CreateStatic2DPoints(), BIAS::UnscentedTransform::ComputeSigmaPoints_(), BIAS::Triangulation::CorrectCorrespondences(), BIAS::GenSynthMatches::GetGTNormalizedF(), BIAS::MonteCarloTransform::GetSamples_(), and BIAS::MonteCarloTransform::Transform().
|
inlineinherited |
|
protected |
Definition at line 240 of file CannyEdge.cpp.
References BIAS::Image< StorageType >::GetImageData(), BIAS::Image< StorageType >::GetMinMaxPixelValue(), and BIAS::ImageBase::GetPixelCount().
|
virtual |
call for getting all intermediary results
Definition at line 58 of file CannyEdge.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::ImageBase::GetWidth(), BIAS::Image< StorageType >::Init(), BIAS::ImageBase::IsEmpty(), and BIAS::Image< StorageType >::Release().
|
virtual |
call for only getting the (binary) edge image
Implements BIAS::FilterBase< InputStorageType, OutputStorageType >.
Definition at line 104 of file CannyEdge.cpp.
|
inlineinherited |
Definition at line 129 of file FilterBase.hh.
|
inherited |
Definition at line 61 of file FilterBase.cpp.
Referenced by BIAS::Rescale< InputStorageType, OutputStorageType >::GetBordersValid_().
|
virtual |
not implemented
Implements BIAS::FilterBase< InputStorageType, OutputStorageType >.
Definition at line 234 of file CannyEdge.cpp.
|
inlineinherited |
Definition at line 332 of file Debug.hh.
Referenced by BIAS::listenthread(), BIAS::Image< StorageType >::operator=(), and BIAS::ImageBase::operator=().
|
inlineinherited |
|
inlineinherited |
|
inlinestaticinherited |
|
inlineinherited |
|
inlineinherited |
creates a new debuglevel
Definition at line 474 of file Debug.hh.
Referenced by BIAS::COSAC< SolutionType >::COSAC(), BIAS::ProjectionParametersPerspectiveDepth::Init(), BIAS::MonteCarloTransform::MonteCarloTransform(), BIAS::PMatrixEstimation::PMatrixEstimation(), BIAS::PreemptiveRANSAC< SolutionType >::PreemptiveRANSAC(), BIAS::RANSACPreKnowledge< SolutionType >::RANSACPreKnowledge(), BIAS::ROI::ROI(), BIAS::RotationAveraging::RotationAveraging(), BIAS::SceneOpenSceneGraph::SceneOpenSceneGraph(), BIAS::ThreeDOutOpenSceneGraph::ThreeDOutOpenSceneGraph(), BIAS::Triangulation::Triangulation(), and BIAS::UnscentedTransform::UnscentedTransform().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Definition at line 127 of file FilterBase.hh.
Referenced by BIAS::PMDImageProc::DenoiseDepthImage(), BIAS::CalibratedPyramid< StorageType >::Downsample_(), BIAS::PMDImageProc::FitDepthTo2DImage(), and BIAS::PMDImageProc::FitDepthTo2DImageFree_().
|
inlineinherited |
Definition at line 318 of file Debug.hh.
Referenced by BIAS::ShowCamWxVideoSourceFactory::CreateBumbleBee(), BIAS::ShowCamWxVideoSourceFactory::CreateDCAM(), BIAS::VideoSource_MDcam::ScanBus(), BIAS::GLProjectionParametersBase::SetDebugLevel(), BIAS::VideoSource_Disk::VideoSource_Disk(), BIAS::VideoSource_DV2::VideoSource_DV2(), BIAS::VideoSource_DV::VideoSource_DV_Internal_Init_(), and BIAS::VideoSource_V4L::VideoSource_V4L().
|
inlineinherited |
|
inlineinherited |
int BIAS::CannyEdge< InputStorageType, OutputStorageType >::SetEdgeWidth | ( | unsigned int | edgeWidth | ) |
set edge width for hysteresis.
In the hysteresis step, we walk along the detected edge pixels and look at the neighboring pixels in gradient direction to determine a pixel best suiting the edge (in terms of highest magnitude). edgeWidth defines the pixel offset to the neighbor pixels, so that the default value of 1 will result in a result image with one pixel wide edges. A value of 3 will result in a thicker edge, but might give more connectivity along the edges.
Definition at line 302 of file CannyEdge.cpp.
int BIAS::CannyEdge< InputStorageType, OutputStorageType >::SetGaussSigma | ( | float | sigma | ) |
before edge detection, the input image is blurred with a gaussian. Set sigma here (defaults to 1.4)
Definition at line 277 of file CannyEdge.cpp.
|
inlinestaticinherited |
|
inherited |
run over all pixel which do not belong to the roi and set them to some value (typically black)
Definition at line 84 of file FilterBase.cpp.
References BIAS::ImageBase::GetChannelCount(), BIAS::ROI::GetCorners(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetROI(), BIAS::ImageBase::GetWidth(), and BIAS::ROI_Corners.
int BIAS::CannyEdge< InputStorageType, OutputStorageType >::SetThresholdsAbsolute | ( | OutputStorageType | lowAbs_, |
OutputStorageType | highAbs_ | ||
) |
set absolute value of low and high thresholds for hysteresis in magnitude gradient image
Definition at line 284 of file CannyEdge.cpp.
int BIAS::CannyEdge< InputStorageType, OutputStorageType >::SetThresholdsRelative | ( | unsigned int | low_, |
unsigned int | high_ | ||
) |
set value of low and high thresholds for hysteresis in magnitude gradient image in terms of percent of image pixels
Definition at line 293 of file CannyEdge.cpp.
|
inlineinherited |
|
protected |
Definition at line 91 of file CannyEdge.cpp.
References BIAS::Rescale< InputStorageType, OutputStorageType >::Filter(), and BIAS::Rescale< InputStorageType, OutputStorageType >::SetFactor().
|
protectedinherited |
Definition at line 132 of file FilterBase.hh.
Referenced by BIAS::FilterBase< InputStorageType, OutputStorageType >::FilterBase().
|
protectedinherited |
Definition at line 510 of file Debug.hh.
Referenced by BIAS::Debug::operator=(), and BIAS::ImageBase::operator=().
|
protectedinherited |
new concept, debuglevel are managed here in the debug class
Definition at line 516 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
protectedinherited |
Definition at line 517 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
staticprotectedinherited |
Definition at line 511 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
protected |
Definition at line 105 of file CannyEdge.hh.
|
protected |
Definition at line 107 of file CannyEdge.hh.
|
staticprotectedinherited |