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>
69 "providerName",
"Armar3ImageProvider",
"ImageProvider name");
71 "Method",
Chessboard,
"use chessboard for feature tracking")
79 "OpticalFlowTopicName",
"OpticalFlowTopic",
"OpticalFlowTopicName name");
82 "Name of the topic the DebugObserver listens on");
84 "RobotNodeSetName",
"Robot",
"Name of the RobotNodeSet");
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;
167 Ice::Long previousTime;
169 int chessboardWidth, chessboardHeight;
177 float unitFactorX, unitFactorY;
OpticalFlowPropertyDefinitions(std::string prefix)
Brief description of class OpticalFlow.
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
void onExitImageProcessor() override
Exit the ImapeProcessor component.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void process() override
Process the vision component.
void onInitImageProcessor() override
Setup the vision component.
void reportStereoCalibrationChanged(const visionx::StereoCalibration &stereoCalibration, bool, const std::string &, const Ice::Current &c=Ice::emptyCurrent) override
std::string getDefaultName() const override
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
The FPSCounter class provides methods for calculating the frames per second (FPS) count in periodic t...
ImageProcessorPropertyDefinitions(std::string prefix)
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
This file offers overloads of toIce() and fromIce() functions for STL container types.
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface > DebugObserverInterfacePrx
std::optional< float > mean(const boost::circular_buffer< NameValueMap > &buffer, const std::string &key)
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.