Spinning Topp Logo BlackTopp Studios
inc
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mezzanine::Graphics::Procedural::EdgeDetectionModifier Class Reference

A modifier that will reduce the texture to an outline of the detected edges in the texture. More...

#include <edgedetectionmodifier.h>

+ Inheritance diagram for Mezzanine::Graphics::Procedural::EdgeDetectionModifier:
+ Collaboration diagram for Mezzanine::Graphics::Procedural::EdgeDetectionModifier:

Public Types

enum  DetectionMode { DM_Homogenity = 1, DM_Difference = 2, DM_Sobel = 3, DM_Canny = 4 }
 An enum describing which algorithm to use for edge detection. More...
 
typedef VectorContainer VectorBlock
 Convenience typedef for returning a 3x3 matrix of Vector3's containing colour data.
 
typedef std::vector< Vector3VectorContainer
 Convenience typedef for an array of Vector3's.
 

Public Member Functions

 EdgeDetectionModifier ()
 Blank constructor.
 
virtual ~EdgeDetectionModifier ()
 Class destructor.
 
virtual String GetName () const
 Gets the name of this modifier. More...
 
virtual void Modify (TextureBuffer &Buffer)
 Alters the generated pixels in a TextureBuffer. More...
 
EdgeDetectionModifierSetDetectionType (const DetectionMode Mode)
 Sets the detection algorith to use for detecting edges. More...
 
EdgeDetectionModifierSetEdgeDetectionSigma (const UInt8 Sigma)
 Sets the sigma for the blur stage of the Canny filter. More...
 
EdgeDetectionModifierSetLowerThreshold (const UInt8 Low)
 Sets the lower threshold for the Canny filter. More...
 
EdgeDetectionModifierSetUpperThreshold (const UInt8 High)
 Sets the upper threshold for the Canny filter. More...
 
- Public Member Functions inherited from Mezzanine::Graphics::Procedural::TextureModifier
 TextureModifier ()
 Blank constructor.
 
virtual ~TextureModifier ()
 Class destructor.
 

Protected Member Functions

VectorBlock GetBlock (const Integer X, const Integer Y, TextureBuffer &Buffer) const
 Gets the colours of the specified pixel and all surrounding pixels. More...
 
void ProcessCanny (TextureBuffer &Buffer)
 Detect edges using the Canny multi-stage algorithm. More...
 
void ProcessDifference (TextureBuffer &Buffer)
 Detect edges in the provided texture by processing pixels above and below the current pixel. More...
 
void ProcessHomogenity (TextureBuffer &Buffer)
 Detect edges in the provided texture by processing all surrounding pixels. More...
 
void ProcessSobel (TextureBuffer &Buffer)
 Detect edges using the Sobel Operator. More...
 

Protected Attributes

DetectionMode EdgeDetect
 The algorithm to use to detect edges. More...
 
UInt8 EdgeDetectionSigma
 The sigma to set for the blur step of the Canny filter. More...
 
UInt8 LowerThreshold
 The lowest value for each colour channel that will be considered valid. More...
 
UInt8 UpperThreshold
 The highest value for each colour channel that will be considered valid. More...
 

Detailed Description

A modifier that will reduce the texture to an outline of the detected edges in the texture.

Definition at line 84 of file edgedetectionmodifier.h.

Member Enumeration Documentation

An enum describing which algorithm to use for edge detection.

Enumerator
DM_Homogenity 

Detect edges based on difference in colour between the pixel being processed and all surrounding pixels.

DM_Difference 

Detect edges based on difference in colour between opposite surrounding pixels.

DM_Sobel 

Use the Sobel Operator algorithm to detect edges.

DM_Canny 

Use the Canny multi-stage algorthm to detect edges.

Definition at line 88 of file edgedetectionmodifier.h.

Member Function Documentation

EdgeDetectionModifier::VectorBlock Mezzanine::Graphics::Procedural::EdgeDetectionModifier::GetBlock ( const Integer  X,
const Integer  Y,
TextureBuffer Buffer 
) const
protected

Gets the colours of the specified pixel and all surrounding pixels.

Parameters
XThe X coordinate of the center pixel to retrieve.
YThe Y coordinate of the center pixel to retrieve.
BufferThe texture buffer to retrieve pixel data from.
Returns
Returns a pointer to an array of Vector3's that are the colours of the current and surrounding pixels.

Definition at line 469 of file edgedetectionmodifier.cpp.

String Mezzanine::Graphics::Procedural::EdgeDetectionModifier::GetName ( ) const
virtual

Gets the name of this modifier.

Returns
Returns a string containing the name of this modifier.

Implements Mezzanine::Graphics::Procedural::TextureModifier.

Definition at line 512 of file edgedetectionmodifier.cpp.

void Mezzanine::Graphics::Procedural::EdgeDetectionModifier::Modify ( TextureBuffer Buffer)
virtual

Alters the generated pixels in a TextureBuffer.

Parameters
BufferThe buffer to be modified.

Implements Mezzanine::Graphics::Procedural::TextureModifier.

Definition at line 500 of file edgedetectionmodifier.cpp.

void Mezzanine::Graphics::Procedural::EdgeDetectionModifier::ProcessCanny ( TextureBuffer Buffer)
protected

Detect edges using the Canny multi-stage algorithm.

Parameters
BufferThe texture buffer to be rendered to.

Definition at line 191 of file edgedetectionmodifier.cpp.

void Mezzanine::Graphics::Procedural::EdgeDetectionModifier::ProcessDifference ( TextureBuffer Buffer)
protected

Detect edges in the provided texture by processing pixels above and below the current pixel.

Parameters
BufferThe texture buffer to be rendered to.

Definition at line 127 of file edgedetectionmodifier.cpp.

void Mezzanine::Graphics::Procedural::EdgeDetectionModifier::ProcessHomogenity ( TextureBuffer Buffer)
protected

Detect edges in the provided texture by processing all surrounding pixels.

Parameters
BufferThe texture buffer to be rendered to.

Definition at line 92 of file edgedetectionmodifier.cpp.

void Mezzanine::Graphics::Procedural::EdgeDetectionModifier::ProcessSobel ( TextureBuffer Buffer)
protected

Detect edges using the Sobel Operator.

Parameters
BufferThe texture buffer to be rendered to.

Definition at line 163 of file edgedetectionmodifier.cpp.

EdgeDetectionModifier & Mezzanine::Graphics::Procedural::EdgeDetectionModifier::SetDetectionType ( const DetectionMode  Mode)

Sets the detection algorith to use for detecting edges.

Parameters
ModeThe detection algorith to use.
Returns
Returns a reference to this.

Definition at line 518 of file edgedetectionmodifier.cpp.

EdgeDetectionModifier & Mezzanine::Graphics::Procedural::EdgeDetectionModifier::SetEdgeDetectionSigma ( const UInt8  Sigma)

Sets the sigma for the blur stage of the Canny filter.

Remarks
This variable is only used if DM_Canny is set as the detection method.
Parameters
SigmaThe sigma to set for the blur step of the Canny filter.
Returns
Returns a reference to this.

Definition at line 536 of file edgedetectionmodifier.cpp.

EdgeDetectionModifier & Mezzanine::Graphics::Procedural::EdgeDetectionModifier::SetLowerThreshold ( const UInt8  Low)

Sets the lower threshold for the Canny filter.

Remarks
This variable is only used if DM_Canny is set as the detection method.
Parameters
LowThe lowest value for each colour channel that will be considered valid.
Returns
Returns a reference to this.

Definition at line 524 of file edgedetectionmodifier.cpp.

EdgeDetectionModifier & Mezzanine::Graphics::Procedural::EdgeDetectionModifier::SetUpperThreshold ( const UInt8  High)

Sets the upper threshold for the Canny filter.

Remarks
This variable is only used if DM_Canny is set as the detection method.
Parameters
HighThe highest value for each colour channel that will be considered valid.
Returns
Returns a reference to this.

Definition at line 530 of file edgedetectionmodifier.cpp.

Member Data Documentation

DetectionMode Mezzanine::Graphics::Procedural::EdgeDetectionModifier::EdgeDetect
protected

The algorithm to use to detect edges.

Definition at line 103 of file edgedetectionmodifier.h.

UInt8 Mezzanine::Graphics::Procedural::EdgeDetectionModifier::EdgeDetectionSigma
protected

The sigma to set for the blur step of the Canny filter.

Definition at line 112 of file edgedetectionmodifier.h.

UInt8 Mezzanine::Graphics::Procedural::EdgeDetectionModifier::LowerThreshold
protected

The lowest value for each colour channel that will be considered valid.

Definition at line 106 of file edgedetectionmodifier.h.

UInt8 Mezzanine::Graphics::Procedural::EdgeDetectionModifier::UpperThreshold
protected

The highest value for each colour channel that will be considered valid.

Definition at line 109 of file edgedetectionmodifier.h.


The documentation for this class was generated from the following files: