ReadFramework
rdf::PixelSet Class Reference

PixelSet stores and manipulates pixel collections. More...

#include <PixelSet.h>

Inheritance diagram for rdf::PixelSet:
Collaboration diagram for rdf::PixelSet:

Public Types

enum  ConnectionMode { connect_Delaunay, connect_region, connect_end }
 
enum  mDrawFlags {
  draw_nothing = 0x0, draw_pixels = 0x1, draw_poly = 0x2, draw_rect = 0x4,
  draw_end
}
 
typedef Flags< mDrawFlagsDrawFlags
 

Public Member Functions

 PixelSet ()
 
 PixelSet (const QVector< QSharedPointer< Pixel > > &set)
 
void operator+= (const PixelSet &set)
 
QSharedPointer< Pixeloperator[] (int idx) const
 
void operator<< (const QSharedPointer< Pixel > &pixel)
 
void operator<< (const PixelSet &set)
 
bool isEmpty () const
 
bool contains (const QSharedPointer< Pixel > &pixel) const
 
virtual void add (const QSharedPointer< Pixel > &pixel)
 
virtual void remove (const QSharedPointer< Pixel > &pixel)
 
virtual void append (const QVector< QSharedPointer< Pixel > > &set)
 
virtual void scale (double factor)
 
virtual void filterDuplicates (int eps=5)
 
QVector< QSharedPointer< Pixel > > pixels () const
 
int size () const
 
QVector< Vector2DpointSet (double offsetAngle=0.0) const
 Returns a point set. The points are sampled along the pixel's ellipses w.r.t the relative angle which is added to the text line orientation. If angle == DBL_MAX or pixel->stats() == NULL, the ellipse centers are sampled instead. More...
 
QVector< Vector2Dcenters () const
 
Polygon convexHull () const
 
Rect boundingBox () const
 
Line fitLine (double offsetAngle=0.0) const
 
Ellipse fitEllipse () const
 
Vector2D center () const
 
Vector2D meanCenter () const
 
double orientation (double statMoment=0.5) const
 Computes the sets median orientation. More...
 
double lineSpacing (double statMoment=0.5) const
 
double area () const
 
QSharedPointer< Pixelfind (const QString &id) const
 Returns the pixel having the id specified. If no pixel with this ID exists, a null pointer is returned. More...
 
QSharedPointer< TextLinetoTextLine () const
 
virtual void draw (QPainter &p, const DrawFlags &options=DrawFlags()|draw_pixels|draw_poly, const Pixel::DrawFlags &pixelOptions=Pixel::DrawFlags()|Pixel::draw_ellipse|Pixel::draw_label_colors) const
 
QVector< PixelSetsplitScales () const
 
virtual QString toString () const override
 
- Public Member Functions inherited from rdf::BaseElement
 BaseElement (const QString &id=QString())
 This class keeps an ID to keep track of transformed elements during a processing chain. You can e.g. generate Pixel elements from MserBlobs. After filtering, processing etc. you can map back to the (pixel accurate) MserBlob using this ID. More...
 
void setId (const QString &id)
 Sets the (preferably unique) ID. If no ID is set, a unqiue ID is generated and assigned. More...
 
QString id () const
 Returns the elment's id. More...
 

Static Public Member Functions

static QVector< QSharedPointer< PixelEdge > > connect (const QVector< QSharedPointer< Pixel > > &superPixels, const ConnectionMode &mode=connect_Delaunay)
 This is a convenience function that connects SuperPixels. It is recommended to use the connector classes respectively. More...
 
static QVector< PixelSetfromEdges (const QVector< QSharedPointer< PixelEdge > > &edges)
 
static PixelSet merge (const QVector< PixelSet > &sets)
 Merges multiple pixel sets to one set. More...
 

Protected Member Functions

Polygon polygon (const QVector< Vector2D > &pts) const
 Returns a poly line along the points defined by angle. If maxAngleThr != -1, points are rejected if the cosine of their enclosing angle is smaller than maxAngleThr. e.g. maxAngleThr = 0 would allow polygon changes of up to 90°. More...
 

Protected Attributes

QVector< QSharedPointer< Pixel > > mSet
 
- Protected Attributes inherited from rdf::BaseElement
QString mId
 

Detailed Description

PixelSet stores and manipulates pixel collections.

See also
BaseElement

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
connect_Delaunay 
connect_region 
connect_end 
Enumerator
draw_nothing 
draw_pixels 
draw_poly 
draw_rect 
draw_end 

Constructor & Destructor Documentation

rdf::PixelSet::PixelSet ( )
rdf::PixelSet::PixelSet ( const QVector< QSharedPointer< Pixel > > &  set)

Member Function Documentation

void rdf::PixelSet::add ( const QSharedPointer< Pixel > &  pixel)
virtual

Reimplemented in rdf::TextLineSet.

Here is the caller graph for this function:

void rdf::PixelSet::append ( const QVector< QSharedPointer< Pixel > > &  set)
virtual

Reimplemented in rdf::TextLineSet.

Here is the caller graph for this function:

double rdf::PixelSet::area ( ) const
Rect rdf::PixelSet::boundingBox ( ) const

Here is the caller graph for this function:

Vector2D rdf::PixelSet::center ( ) const

Here is the caller graph for this function:

QVector< Vector2D > rdf::PixelSet::centers ( ) const
QVector< QSharedPointer< PixelEdge > > rdf::PixelSet::connect ( const QVector< QSharedPointer< Pixel > > &  superPixels,
const ConnectionMode mode = connect_Delaunay 
)
static

This is a convenience function that connects SuperPixels. It is recommended to use the connector classes respectively.

Parameters
superPixelsThe super pixels.
rectThe bounding rect.
modeThe connection mode.
Returns

Here is the caller graph for this function:

bool rdf::PixelSet::contains ( const QSharedPointer< Pixel > &  pixel) const

Here is the caller graph for this function:

Polygon rdf::PixelSet::convexHull ( ) const

Here is the caller graph for this function:

void rdf::PixelSet::draw ( QPainter &  p,
const DrawFlags options = DrawFlags() | draw_pixels | draw_poly,
const Pixel::DrawFlags pixelOptions = Pixel::DrawFlags() | Pixel::draw_ellipse | Pixel::draw_label_colors 
) const
virtual

Reimplemented in rdf::TextLineSet.

Here is the caller graph for this function:

void rdf::PixelSet::filterDuplicates ( int  eps = 5)
virtual
QSharedPointer< Pixel > rdf::PixelSet::find ( const QString &  id) const

Returns the pixel having the id specified. If no pixel with this ID exists, a null pointer is returned.

Parameters
idThe pixel id.
Returns
Ellipse rdf::PixelSet::fitEllipse ( ) const

Here is the caller graph for this function:

Line rdf::PixelSet::fitLine ( double  offsetAngle = 0.0) const

Here is the caller graph for this function:

QVector< PixelSet > rdf::PixelSet::fromEdges ( const QVector< QSharedPointer< PixelEdge > > &  edges)
static

Here is the caller graph for this function:

bool rdf::PixelSet::isEmpty ( ) const

Here is the caller graph for this function:

double rdf::PixelSet::lineSpacing ( double  statMoment = 0.5) const

Here is the caller graph for this function:

Vector2D rdf::PixelSet::meanCenter ( ) const
PixelSet rdf::PixelSet::merge ( const QVector< PixelSet > &  sets)
static

Merges multiple pixel sets to one set.

Parameters
setsThe sets.
Returns
void rdf::PixelSet::operator+= ( const PixelSet set)
void rdf::PixelSet::operator<< ( const QSharedPointer< Pixel > &  pixel)
void rdf::PixelSet::operator<< ( const PixelSet set)
QSharedPointer< Pixel > rdf::PixelSet::operator[] ( int  idx) const
double rdf::PixelSet::orientation ( double  statMoment = 0.5) const

Computes the sets median orientation.

Parameters
statMomentif != 0.5 a quartile other than the median is computed.
Returns
The set's median orientation.

Here is the caller graph for this function:

QVector<QSharedPointer<Pixel> > rdf::PixelSet::pixels ( ) const
inline

Here is the caller graph for this function:

QVector< Vector2D > rdf::PixelSet::pointSet ( double  offsetAngle = 0.0) const

Returns a point set. The points are sampled along the pixel's ellipses w.r.t the relative angle which is added to the text line orientation. If angle == DBL_MAX or pixel->stats() == NULL, the ellipse centers are sampled instead.

Parameters
offsetAngleThe angle which is added to the pixel's local orientation.
Returns

Here is the caller graph for this function:

Polygon rdf::PixelSet::polygon ( const QVector< Vector2D > &  pts) const
protected

Returns a poly line along the points defined by angle. If maxAngleThr != -1, points are rejected if the cosine of their enclosing angle is smaller than maxAngleThr. e.g. maxAngleThr = 0 would allow polygon changes of up to 90°.

Parameters
angleThe angle for sampling the ellipses.
maxAngleThrThe maximum angle thresh.
Returns

Returns the convex hull of the PixelSet.

Returns

Here is the caller graph for this function:

void rdf::PixelSet::remove ( const QSharedPointer< Pixel > &  pixel)
virtual

Reimplemented in rdf::TextLineSet.

Here is the caller graph for this function:

void rdf::PixelSet::scale ( double  factor)
virtual

Reimplemented from rdf::BaseElement.

Reimplemented in rdf::TextLineSet.

Here is the caller graph for this function:

int rdf::PixelSet::size ( ) const

Here is the caller graph for this function:

QVector< PixelSet > rdf::PixelSet::splitScales ( ) const
QString rdf::PixelSet::toString ( ) const
overridevirtual

Reimplemented from rdf::BaseElement.

QSharedPointer< TextLine > rdf::PixelSet::toTextLine ( ) const

Member Data Documentation

QVector<QSharedPointer<Pixel> > rdf::PixelSet::mSet
protected

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