18 #ifndef __ICUB_LBPEXTRACT_MOD_H__
19 #define __ICUB_LBPEXTRACT_MOD_H__
21 #include <yarp/os/BufferedPort.h>
22 #include <yarp/os/RFModule.h>
23 #include <yarp/os/Network.h>
24 #include <yarp/os/Thread.h>
25 #include <yarp/os/PeriodicThread.h>
26 #include <yarp/os/Time.h>
27 #include <yarp/os/Stamp.h>
28 #include <yarp/os/RpcClient.h>
29 #include <yarp/sig/Vector.h>
30 #include <yarp/sig/Image.h>
42 #include <opencv2/opencv.hpp>
45 #include "histogram.h"
47 #include <lbpExtract_IDLServer.h>
50 class SEGMENTManager :
public yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> >
54 std::string moduleName;
55 std::string inPortName;
57 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > outPortPropagate;
58 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > outPortBlobs;
59 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > outPortSegmented;
60 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelMono> > outPortLbp;
61 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelMono> > outPortLbpContours;
63 yarp::os::BufferedPort<yarp::os::Bottle> outTargetPort;
66 int radius, defaultRadius;
67 int neighbours, defaultNeighbours;
68 int topBound, defaultTopBound;
69 int minArcLength, defaultMinArcLength;
70 int maxArcLength, defaultMaxArcLength;
71 int numIteration, defaultNumIteration;
72 int minArea, defaultMinArea;
73 int maxArea, defaultMaxArea;
74 int minWidth, defaultMinWidth;
79 yarp::os::Bottle allPoints;
80 yarp::os::Bottle& getComponents(cv::Mat &img,
int x,
int y);
90 SEGMENTManager(
const std::string &moduleName );
97 void onRead( yarp::sig::ImageOf<yarp::sig::PixelRgb> &img );
100 bool setDefaultValues(
const int32_t radius,
const int32_t neighbours,
const int32_t topBound,
const int32_t minArcLength,
const int32_t maxArcLength,
const int32_t numIteration,
const int32_t minArea,
const int32_t maxArea,
const int32_t minWidth );
102 bool setRadius(
const int32_t radius);
103 bool setNeighbours(
const int32_t neighbours);
104 bool setTopBound(
const int32_t topBound);
105 bool setMinArcLength(
const int32_t minArcLength);
106 bool setMaxArcLength(
const int32_t maxArcLength);
107 bool setNumIteration(
const int32_t numIteration);
108 bool setMinArea(
const int32_t minArea);
109 bool setMaxArea(
const int32_t maxArea);
110 bool setMinWidth(
const int32_t minWidth);
111 bool setbbOffset(
const int32_t offset);
112 bool resetAllValues();
113 bool verbosity(
const int32_t boolVerbosity);
116 int32_t getNeighbours();
117 int32_t getTopBound();
118 int32_t getMinArcLength();
119 int32_t getMaxArcLength();
120 int32_t getMinArea();
121 int32_t getMaxArea();
122 int32_t getMinWidth();
123 int32_t getNumIteration();
124 int32_t getbbOffset();
125 yarp::os::Bottle get_component_around(
const int32_t x,
const int32_t y);
131 std::string moduleName;
132 std::string handlerPortName;
133 yarp::os::RpcServer rpcPort;
136 SEGMENTManager *segmentManager;
139 friend class segmentManager;
143 bool configure(yarp::os::ResourceFinder &rf);
144 bool interruptModule();
147 bool attach(yarp::os::RpcServer &source);
159 bool setMinWidth(
const int32_t minWidth);
161 bool verbosity(
const int32_t boolVerbosity);
171 int32_t getMinWidth();