1 #ifndef VISP_TRACKER_CONVERSION_HH 2 # define VISP_TRACKER_CONVERSION_HH 3 # include <boost/optional.hpp> 7 # include <geometry_msgs/Transform.h> 8 # include <sensor_msgs/Image.h> 9 # include <sensor_msgs/CameraInfo.h> 12 # include <visp_tracker/Init.h> 14 # include <visp3/core/vpConfig.h> 15 # include <visp3/mbt/vpMbGenericTracker.h> 17 # include <visp3/core/vpHomogeneousMatrix.h> 18 # include <visp3/core/vpCameraParameters.h> 19 # include <visp3/me/vpMe.h> 20 # include <visp3/klt/vpKltOpencv.h> 33 const sensor_msgs::Image::ConstPtr& src);
46 const vpImage<unsigned char>& src);
55 const vpHomogeneousMatrix& src);
58 const geometry_msgs::Transform& src);
64 const geometry_msgs::Pose& src);
67 visp_tracker::Init& srv);
70 vpMbGenericTracker &tracker);
73 const vpMbGenericTracker &tracker,
74 visp_tracker::Init& srv);
77 vpMbGenericTracker &tracker,
81 const vpMbGenericTracker &tracker,
82 visp_tracker::Init& srv);
85 vpMbGenericTracker &tracker,
89 sensor_msgs::CameraInfoConstPtr info);
92 template<
class ConfigType>
94 vpMbGenericTracker &tracker)
96 tracker.setAngleAppear(vpMath::rad(config.angle_appear));
97 tracker.setAngleDisappear(vpMath::rad(config.angle_disappear));
100 template<
class ConfigType>
104 config.angle_appear = vpMath::deg(tracker.getAngleAppear());
105 config.angle_disappear = vpMath::deg(tracker.getAngleDisappear());
108 template<
class ConfigType>
111 vpMbGenericTracker &tracker)
113 tracker.setGoodMovingEdgesRatioThreshold(config.first_threshold);
114 moving_edge.setThreshold( config.threshold );
115 moving_edge.setMaskSize( config.mask_size );
116 moving_edge.setRange( config.range );
117 moving_edge.setMu1( config.mu1 );
118 moving_edge.setMu2( config.mu2 );
119 moving_edge.setSampleStep( config.sample_step );
120 moving_edge.setStrip( config.strip );
123 moving_edge.initMask();
125 tracker.setMovingEdge(moving_edge);
128 template<
class ConfigType>
130 const vpMbGenericTracker &tracker,
133 config.first_threshold = tracker.getGoodMovingEdgesRatioThreshold();
134 config.threshold = moving_edge.getThreshold();
135 config.mask_size = moving_edge.getMaskSize();
136 config.range = moving_edge.getRange();
137 config.mu1 = moving_edge.getMu1();
138 config.mu2 = moving_edge.getMu2();
139 config.sample_step = moving_edge.getSampleStep();
140 config.strip = moving_edge.getStrip();
143 template<
class ConfigType>
146 vpMbGenericTracker &tracker)
148 klt.setMaxFeatures(config.max_features);
149 klt.setWindowSize(config.window_size);
150 klt.setQuality(config.quality);
151 klt.setMinDistance(config.min_distance);
152 klt.setHarrisFreeParameter(config.harris);
153 klt.setBlockSize(config.size_block);
154 klt.setPyramidLevels(config.pyramid_lvl);
155 tracker.setKltMaskBorder((
unsigned)config.mask_border);
157 tracker.setKltOpencv(klt);
160 template<
class ConfigType>
162 const vpMbGenericTracker &tracker,
165 config.max_features = klt.getMaxFeatures();
166 config.window_size = klt.getWindowSize();
167 config.quality = klt.getQuality();
168 config.min_distance = klt.getMinDistance();
169 config.harris = klt.getHarrisFreeParameter();
170 config.size_block = klt.getBlockSize();
171 config.pyramid_lvl = klt.getPyramidLevels();
172 config.mask_border = tracker.getKltMaskBorder();
void convertModelBasedSettingsConfigToVpKltOpencv(const ConfigType &config, vpKltOpencv &klt, vpMbGenericTracker &tracker)
std::string convertVpMbTrackerToRosMessage(const vpMbGenericTracker &tracker)
void vpHomogeneousMatrixToTransform(geometry_msgs::Transform &dst, const vpHomogeneousMatrix &src)
void convertVpMeToInitRequest(const vpMe &moving_edge, const vpMbGenericTracker &tracker, visp_tracker::Init &srv)
void convertInitRequestToVpMe(const visp_tracker::Init::Request &req, vpMbGenericTracker &tracker, vpMe &moving_edge)
void convertInitRequestToVpKltOpencv(const visp_tracker::Init::Request &req, vpMbGenericTracker &tracker, vpKltOpencv &klt)
void convertModelBasedSettingsConfigToVpMbTracker(const ConfigType &config, vpMbGenericTracker &tracker)
void vispImageToRos(sensor_msgs::Image &dst, const vpImage< unsigned char > &src)
Convert a ViSP image into a ROS one.
void convertInitRequestToVpMbTracker(const visp_tracker::Init::Request &req, vpMbGenericTracker &tracker)
void initializeVpCameraFromCameraInfo(vpCameraParameters &cam, sensor_msgs::CameraInfoConstPtr info)
void transformToVpHomogeneousMatrix(vpHomogeneousMatrix &dst, const geometry_msgs::Transform &src)
void convertVpMbTrackerToInitRequest(const vpMbGenericTracker &tracker, visp_tracker::Init &srv)
void convertModelBasedSettingsConfigToVpMe(const ConfigType &config, vpMe &moving_edge, vpMbGenericTracker &tracker)
void convertVpMeToModelBasedSettingsConfig(const vpMe &moving_edge, const vpMbGenericTracker &tracker, ConfigType &config)
void rosImageToVisp(vpImage< unsigned char > &dst, const sensor_msgs::Image::ConstPtr &src)
Convert a ROS image into a ViSP one.
std::string convertVpMeToRosMessage(const vpMbGenericTracker &tracker, const vpMe &moving_edge)
void convertVpMbTrackerToModelBasedSettingsConfig(const vpMbGenericTracker &tracker, ConfigType &config)
void convertVpKltOpencvToInitRequest(const vpKltOpencv &klt, const vpMbGenericTracker &tracker, visp_tracker::Init &srv)
void convertVpKltOpencvToModelBasedSettingsConfig(const vpKltOpencv &klt, const vpMbGenericTracker &tracker, ConfigType &config)
std::string convertVpKltOpencvToRosMessage(const vpMbGenericTracker &tracker, const vpKltOpencv &klt)