30 #include <Eigen/Geometry>
32 #include <opencv2/opencv.hpp>
38 #include <VisionX/interface/components/Calibration.h>
39 #include <VisionX/interface/components/OpticalFlowInterface.h>
43 #include <Image/IplImageAdaptor.h>
67 defineOptionalProperty<float>(
"Framerate", 0.0,
"the framerate");
68 defineOptionalProperty<std::string>(
69 "providerName",
"Armar3ImageProvider",
"ImageProvider name");
70 defineOptionalProperty<OPTICAL_FLOW_METHOD>(
71 "Method",
Chessboard,
"use chessboard for feature tracking")
76 defineOptionalProperty<int>(
"Chessboard.Width", 7,
"Chessboard width");
77 defineOptionalProperty<int>(
"Chessboard.Height", 5,
"Chessboard height");
78 defineOptionalProperty<std::string>(
79 "OpticalFlowTopicName",
"OpticalFlowTopic",
"OpticalFlowTopicName name");
80 defineOptionalProperty<std::string>(
"DebugObserverName",
82 "Name of the topic the DebugObserver listens on");
83 defineOptionalProperty<std::string>(
84 "RobotNodeSetName",
"Robot",
"Name of the RobotNodeSet");
86 defineOptionalProperty<std::string>(
"CalibrationUpdateTopicName",
87 "StereoCalibrationInterface",
88 "Topic name of the stereo calibration provider");
112 return "OpticalFlow";
119 const Ice::Current&
c = Ice::emptyCurrent)
override
122 std::unique_lock lock(imageMutex);
124 float f_x = stereoCalibration.calibrationRight.cameraParam.focalLength[0];
125 float f_y = stereoCalibration.calibrationRight.cameraParam.focalLength[1];
128 2.0 * std::atan(imageDimension.width / (2.0 * f_x)) / imageDimension.width;
130 2.0 * std::atan(imageDimension.height / (2.0 * f_y)) / imageDimension.height;
150 std::vector<float> removeHighestAndLowestMember(std::vector<float>&
input);
152 drawDenseFlowMap(
const cv::Mat& flow, cv::Mat& cflowmap,
int step,
const cv::Scalar& color);
153 void computeAverageDenseFlow(
const cv::Mat& flow,
double&
mean,
double& rmse);
154 void ComputeOpticalFlow(cv::Mat resultImage, cv::Mat grayImage);
156 CByteImage** cameraImages;
157 std::string providerName;
158 std::mutex imageMutex;
159 cv::Mat previousImage, old2;
160 std::vector<cv::Point2f> previousFeatures;
161 visionx::ImageProviderInterfacePrx imageProviderPrx;
162 OpticalFlowListenerPrx prx;
163 visionx::ImageDimension imageDimension;
165 float resultX, resultY, timeDiff;
169 int chessboardWidth, chessboardHeight;
177 float unitFactorX, unitFactorY;