segmentation
All Data Structures Namespaces Files Functions Variables Modules Pages
Public Member Functions
GBSegmModule Class Reference

Segmentation Module. More...

#include <SegmModule.h>

Inheritance diagram for GBSegmModule:
yarp::sig::SegmentationModuleInterface

Public Member Functions

virtual bool configure (yarp::os::ResourceFinder &rf)
 
virtual bool close ()
 
virtual bool interruptModule ()
 
virtual bool updateModule ()
 
bool attach (yarp::os::Port &source)
 
virtual void set_sigma (const double newValue)
 Set sigma (smoothing) parameter for the algorithm. More...
 
virtual void set_k (const double newValue)
 Set k (scale factor for boundary-detection threshold function) parameter for the algorithm. More...
 
virtual void set_minRegion (const double newValue)
 Set minRegion parameter for the algorithm, i.e., the minimum size of any segmented component. More...
 
virtual double get_sigma ()
 Get sigma (smoothing) parameter for the algorithm. More...
 
virtual double get_k ()
 Get k (scale factor for boundary-detection threshold function) parameter for the algorithm. More...
 
virtual double get_minRegion ()
 Get minRegion parameter for the algorithm, i.e., the minimum size of any segmented component. More...
 
virtual int32_t get_num_components ()
 Get the number of segmented components that have been detected in the last provided image. More...
 
virtual std::vector< yarp::sig::Pixelget_component_around (const yarp::sig::Pixel &objCenter)
 Get the list of pixels corresponding to the component to which a given pixel belongs. More...
 
virtual std::vector< std::string > help (const std::string &functionName="--all")
 
bool read (yarp::os::ConnectionReader &connection) override
 

Detailed Description

Segmentation Module.

Definition at line 31 of file SegmModule.h.

Member Function Documentation

◆ get_component_around()

std::vector< Pixel > GBSegmModule::get_component_around ( const yarp::sig::Pixel objCenter)
virtual

Get the list of pixels corresponding to the component to which a given pixel belongs.

Parameters
objCentera pixel belonging to the region of interest
Returns
list of pixels belonging to the same component as the input pixels

Reimplemented from yarp::sig::SegmentationModuleInterface.

Definition at line 71 of file SegmModule.cpp.

72 {
73  vector<Pixel> result;
74  result.clear();
75  lock_guard<mutex> lg(segMutex);
76  rgb componentColor = imRef(seg, objCenter.x, objCenter.y);
77  for (int y = 0; y < seg->height(); y++) {
78 
79  for (int x = 0; x < seg->width(); x++) {
80 
81  if (imRef(seg, x, y) == componentColor)
82  result.push_back(Pixel(x, y));
83 
84 
85  }
86 
87  }
88 
89  return result;
90 }
Pixel position in the image frame.
Definition: Pixel.h:28
std::int32_t y
Index of pixel along vertical axis.
Definition: Pixel.h:38
std::int32_t x
Index of pixel along horizontal axis.
Definition: Pixel.h:34

References yarp::sig::Pixel::x, and yarp::sig::Pixel::y.

◆ get_k()

double GBSegmModule::get_k ( )
virtual

Get k (scale factor for boundary-detection threshold function) parameter for the algorithm.

Returns
current value for k parameter

Reimplemented from yarp::sig::SegmentationModuleInterface.

Definition at line 68 of file SegmModule.cpp.

68 {return k;}

◆ get_minRegion()

double GBSegmModule::get_minRegion ( )
virtual

Get minRegion parameter for the algorithm, i.e., the minimum size of any segmented component.

Returns
current value for minRegion parameter

Reimplemented from yarp::sig::SegmentationModuleInterface.

Definition at line 69 of file SegmModule.cpp.

69 {return min_size;}

◆ get_num_components()

int32_t GBSegmModule::get_num_components ( )
virtual

Get the number of segmented components that have been detected in the last provided image.

Returns
number of segmented components

Reimplemented from yarp::sig::SegmentationModuleInterface.

Definition at line 70 of file SegmModule.cpp.

70 {return num_components;}

◆ get_sigma()

double GBSegmModule::get_sigma ( )
virtual

Get sigma (smoothing) parameter for the algorithm.

Returns
current value for sigma parameter

Reimplemented from yarp::sig::SegmentationModuleInterface.

Definition at line 67 of file SegmModule.cpp.

67 {return sigma;}

◆ set_k()

void GBSegmModule::set_k ( const double  newValue)
virtual

Set k (scale factor for boundary-detection threshold function) parameter for the algorithm.

Parameters
newValuenew value for k parameter

Reimplemented from yarp::sig::SegmentationModuleInterface.

Definition at line 65 of file SegmModule.cpp.

65 {k=(float)newValue;}

◆ set_minRegion()

void GBSegmModule::set_minRegion ( const double  newValue)
virtual

Set minRegion parameter for the algorithm, i.e., the minimum size of any segmented component.

Parameters
newValuenew value for minRegion parameter

Reimplemented from yarp::sig::SegmentationModuleInterface.

Definition at line 66 of file SegmModule.cpp.

66 {min_size=(int)newValue;}

◆ set_sigma()

void GBSegmModule::set_sigma ( const double  newValue)
virtual

Set sigma (smoothing) parameter for the algorithm.

Parameters
newValuenew value for sigma parameter

Reimplemented from yarp::sig::SegmentationModuleInterface.

Definition at line 64 of file SegmModule.cpp.

64 {sigma=(float)newValue;}

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