23 #ifndef _HPESTIMATION_ 24 #define _HPESTIMATION_ 33 #include <yarp/os/RFModule.h> 34 #include <yarp/os/Bottle.h> 35 #include <yarp/os/Time.h> 36 #include <yarp/os/Log.h> 37 #include <yarp/os/LogStream.h> 38 #include <yarp/os/BufferedPort.h> 39 #include <yarp/sig/Image.h> 40 #include <yarp/sig/Vector.h> 43 #include <opencv2/core/core.hpp> 44 #include <opencv2/imgproc/imgproc.hpp> 45 #include <opencv2/highgui/highgui.hpp> 47 #include "handPoseEstimation_IDL.h" 57 std::string moduleName;
60 std::string handlerPortName;
61 std::string imageInputPortRName;
62 std::string imageInputPortLName;
63 std::string armPortName;
64 std::string headPortName;
65 std::string likelihoodPortName;
66 std::string LRimageOutputPortName;
67 std::string headOutPortName;
68 std::string particlesOutPortName;
69 std::string offsetsPortName;
74 double initialMean,initialStdDev;
75 double initialArtificialNoiseStdDev, artifNoiseStdDev;
76 double lowerBoundNoise, upperBoundNoise, increasedMultiplier, decreasedMultiplier;
77 double minimumLikelihood;
82 yarp::os::Bottle lastBestOffset;
83 yarp::sig::Vector encodersArm, encodersHead;
85 cv::Mat imageR, imageL;
86 cv::Mat imageProcR, imageProcL;
87 cv::Mat concatenatedImage;
101 CvMat* particles1to7;
102 CvMat* newParticles1to7;
108 yarp::os::RpcServer handlerPort;
109 yarp::os::BufferedPort< yarp::sig::ImageOf<yarp::sig::PixelBgr> > imageInputPortR;
110 yarp::os::BufferedPort< yarp::sig::ImageOf<yarp::sig::PixelBgr> > imageInputPortL;
111 yarp::os::BufferedPort< yarp::os::Bottle > armPort;
112 yarp::os::BufferedPort< yarp::os::Bottle > headPort;
113 yarp::os::BufferedPort< yarp::os::Bottle > likelihoodPort;
115 yarp::os::BufferedPort< yarp::sig::ImageOf< yarp::sig::PixelBgr> > LRimageOutputPort;
116 yarp::os::BufferedPort< yarp::os::Bottle > headOutPort;
117 yarp::os::BufferedPort< yarp::os::Bottle > particlesOutPort;
118 yarp::os::BufferedPort< yarp::os::Bottle > offsetsPort;
119 yarp::os::BufferedPort< yarp::os::Bottle > fingers_port;
120 yarp::os::BufferedPort< yarp::sig::ImageOf< yarp::sig::PixelBgr> > outputPortImage;
121 yarp::os::BufferedPort< yarp::sig::ImageOf< yarp::sig::PixelBgr> > outputPortImage2;
166 bool systematic_resampling(CvMat* oldParticlesState, CvMat* oldParticlesWeights, CvMat* newParticlesState, CvMat* cumWeight,
float sum2);
168 virtual bool configure(yarp::os::ResourceFinder &rf);
169 virtual bool interruptModule();
170 virtual bool close();
171 virtual bool updateModule();
172 virtual double getPeriod();
176 bool attach(yarp::os::RpcServer &source);
bool stop()
Stop the hand pose estimation.
void mergeAndFlipImages()
merge the left and right images.
bool resume()
Resume the hand pose estimation.
bool systematic_resampling(CvMat *oldParticlesState, CvMat *oldParticlesWeights, CvMat *newParticlesState, CvMat *cumWeight, float sum2)
perform the systematic resampling step of the SMC algorithm
bool runSMCIteration()
Run one iteration of the Sequential Monte Carlo Parameters estimation.
Class handPoseEstimationModule.
bool readArmJoints()
Read the arm joints.
bool initializeSMCVariables()
Initialize the variables structs needed for the SMC to run.
bool readHeadJoints()
Read the head joints.
bool initSMC()
Initialize the variables values for the SMC.
bool start()
Start (re-start) the hand pose estimation.
cv::Mat processImages(cv::Mat inputImage)
The function applies a canny edge detector and a distance transform.
bool pause()
Pause the hand pose estimation.
yarp::os::Bottle lastOffsets()
Ask for the last estimated angular Offsets on the arm (7DoF)
handPoseEstimation_IDL IDL Interface to handPoseEstimation-module services.
bool quit()
Quit the module.
void kernelDensityEstimation()
Perform the Kernel Density estimation with a multivariate gaussian kernel.