$extrastylesheet
#include <scribo/core/component_set.hh>
Public Types | |
typedef Object< void > | category |
typedef component_set< L > | exact_t |
Protected Member Functions | |
void | init_ (const component_set< L > &model) |
Protected Attributes | |
mln::util::tracked_ptr< data_t > | data_ |
Related Functions | |
(Note that these are not member functions.) | |
template<typename L > | |
std::ostream & | operator<< (std::ostream &ostr, const component_set< L > &info) |
template<typename L > | |
bool | operator== (const component_set< L > &lhs, const component_set< L > &rhs) |
Represents all the components in a document image.
This structure is used to store rich information related to components in an image.
It can be constructed directly from a labeled image and the number of components, or using primitive::extract::components (easier and recommanded) with a binary image.
Each component is associated to an id, component_id_t. This id is equivalent to the component label in the label image (labeled_image()). They are labeled from 1 to nelements() included. Id 0 is reserved for the background which is not considered as an actual component.
A component_set is considered as valid if it has been initialized (i.e. not instantiated with the default constructor).
On construction, information is automatically computed for each components. To iterate over all the components and get that information, use operator()() or info():
Among component information, a component::Tag tag is stored and used to mark specific components. This tag can be massively updated for all components using update_tags(). The function passed to this method must implement the following interface:
Tags can be used to filter/make a selection of components. Routines performing this selection/filtering automatically are listed in Component Filtering section.
Components considered as separators in the input image (lines, blocks, ...) may be processed separately and are useful of the rest of the layout analysis. This structure allows you to store a binary image of separators which will be used in some routines to prevent wrong regrouping. Note that no component information will be computed for separators. The separator image can be managed with has_separators(), add_separators(), separators(), and clear_separators().
scribo::component_set is the first data structure in the hierarchical representation of a document as explained in Data structures.
Definition at line 217 of file component_set.hh.
scribo::component_set< L >::component_set | ( | ) |
Default.
scribo::component_set< L >::component_set | ( | const mln::util::tracked_ptr< data_t > & | data | ) |
Constructor from internal data.
scribo::component_set< L >::component_set | ( | const L & | ima, |
const typename L::value & | ncomps | ||
) |
Constructor from an image ima
and the number of labels ncomps
.
scribo::component_set< L >::component_set | ( | const L & | ima, |
const typename L::value & | ncomps, | ||
const mln::util::array< pair_accu_t > & | attribs, | ||
component::Type | type = component::Undefined |
||
) |
Constructor from an image ima
, the number of labels ncomps
and attributes values (bounding box and mass center).
scribo::component_set< L >::component_set | ( | const L & | ima, |
const typename L::value & | ncomps, | ||
const mln::util::array< pair_data_t > & | attribs, | ||
component::Type | type = component::Undefined |
||
) |
Constructor from an image ima
, the number of labels ncomps
and attributes values (bounding box and mass center).
|
inherited |
Allow this object to be serialized by visitor
.
void scribo::component_set< L >::add_separators | ( | const typename mln::trait::ch_value< L, bool >::ret & | ima | ) |
Add a new separator binary image or perform a logical OR with the existing one.
void scribo::component_set< L >::clear_separators | ( | ) |
Clear separator image.
component_set<L> scribo::component_set< L >::duplicate | ( | ) | const |
Create a copy of this component_set<L>
bool scribo::component_set< L >::has_separators | ( | ) | const |
Return true if an image of separator exists.
const component_info<L>& scribo::component_set< L >::info | ( | const typename L::value & | id | ) | const |
Return component information for a given component id id
.
component_info<L>& scribo::component_set< L >::info | ( | const typename L::value & | id | ) |
Return component information for a given component id id
.
|
protected |
INTERNAL_API Duplicate the underlying image and create a new component_set.
bool scribo::component_set< L >::is_valid | ( | ) | const |
A component_set is considered as valid if it has been initialized (i.e.
not instantiated with the default constructor).
const L& scribo::component_set< L >::labeled_image | ( | ) | const |
Return the underlying labeled image.
L ::value scribo::component_set< L >::nelements | ( | ) | const |
Return the number of components, background excluded.
component_info<L>& scribo::component_set< L >::operator() | ( | const component_id_t & | id | ) |
Return component information for a given component id id
.
const component_info<L>& scribo::component_set< L >::operator() | ( | const component_id_t & | id | ) | const |
Return component information for a given component id id
.
const mln::trait::ch_value< L , bool >::ret& scribo::component_set< L >::separators | ( | ) | const |
Return the binary image of separators.
void scribo::component_set< L >::update_tags | ( | const mln::Function_v2b< F > & | f, |
component::Tag | tag | ||
) |
Update component tag for which f
returns 'False', with tag
.
|
related |
|
related |