9 #ifndef __EDISONSEGMMODULE__
10 #define __EDISONSEGMMODULE__
17 #include <opencv2/opencv.hpp>
20 #include <yarp/os/all.h>
21 #include <yarp/sig/all.h>
22 #include <yarp/os/RFModule.h>
23 #include <yarp/os/ResourceFinder.h>
24 #include <yarp/os/Stamp.h>
32 #include <segm/msImageProcessor.h>
33 #include "SegmentationModule.h"
39 int orig_height_, height_, orig_width_, width_, dim_;
42 yarp::sig::ImageOf<yarp::sig::PixelRgb> inputImage;
43 unsigned char * inputImage_;
46 yarp::sig::ImageOf<yarp::sig::PixelRgb> inputHsv;
47 unsigned char * inputHsv_;
50 yarp::sig::ImageOf<yarp::sig::PixelMono> inputHue;
51 unsigned char * inputHue_;
54 yarp::sig::ImageOf<yarp::sig::PixelFloat> gradMap;
57 yarp::sig::ImageOf<yarp::sig::PixelFloat> confMap;
60 yarp::sig::ImageOf<yarp::sig::PixelFloat> weightMap;
66 yarp::sig::ImageOf<yarp::sig::PixelRgb> filtImage;
67 unsigned char * filtImage_;
69 yarp::sig::ImageOf<yarp::sig::PixelRgb> segmImage;
70 unsigned char * segmImage_;
72 yarp::sig::ImageOf<yarp::sig::PixelInt> labelImage;
74 yarp::sig::ImageOf<yarp::sig::PixelMono> labelView;
77 int *edges_, numEdges_;
78 int *boundaries_, numBoundaries_;
91 void setSpeedUpValue(
int newSpeedUpValue);
93 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > _imgPort;
94 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > _rawPort;
95 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > _viewPort;
96 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelInt> > _labelPort;
97 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > _filtPort;
98 yarp::os::Port _configPort;
99 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelMono> > _labelViewPort;
101 yarp::os::Stamp _stamp;
107 virtual bool configure (yarp::os::ResourceFinder &rf);
109 virtual bool close();
110 virtual bool interruptModule();
111 virtual bool updateModule();
113 bool attach(yarp::os::Port &source)
115 return this->yarp().attachAsServer(source);
119 virtual void set_sigmaS(
const double newValue){sigmaS=(int)newValue;};
120 virtual void set_sigmaR(
const double newValue){sigmaR=(float)newValue;};
121 virtual void set_minRegion(
const double newValue){minRegion=(int)newValue;};
122 virtual void set_gradWindRad(
const double newValue){gradWindRad=(int)newValue;};
123 virtual void set_threshold(
const double newValue){newValue <=1 ? threshold=(float)newValue: threshold=1;
if (threshold <0) threshold =0;};
124 virtual void set_mixture(
const double newValue){newValue <=1 ? mixture=(float)newValue: mixture=1;
if (mixture<0 ) mixture=0;};
125 virtual void set_speedup(
const SpeedUpLevelComm newSpeedLevel){setSpeedUpValue(newSpeedLevel);};
126 virtual double get_sigmaS(){
return sigmaS;};
127 virtual double get_sigmaR(){
return sigmaR;};
128 virtual double get_minRegion(){
return minRegion;};
129 virtual double get_gradWindRad(){
return gradWindRad;};
130 virtual double get_threshold(){
return threshold;};
131 virtual double get_mixture(){
return mixture;};
132 virtual SpeedUpLevelComm get_speedup(){
return SpeedUpLevelComm(speedup);};
Edison Segmentation Module.