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";
125 const Ice::Current&
c = Ice::emptyCurrent)
override
128 std::unique_lock lock(imageMutex);
130 float f_x = stereoCalibration.calibrationRight.cameraParam.focalLength[0];
131 float f_y = stereoCalibration.calibrationRight.cameraParam.focalLength[1];
134 2.0 * std::atan(imageDimension.width / (2.0 * f_x)) / imageDimension.width;
136 2.0 * std::atan(imageDimension.height / (2.0 * f_y)) / imageDimension.height;
156 std::vector<float> removeHighestAndLowestMember(std::vector<float>& input);
158 drawDenseFlowMap(
const cv::Mat& flow, cv::Mat& cflowmap,
int step,
const cv::Scalar& color);
159 void computeAverageDenseFlow(
const cv::Mat& flow,
double&
mean,
double& rmse);
160 void ComputeOpticalFlow(cv::Mat resultImage, cv::Mat grayImage);
162 CByteImage** cameraImages;
163 std::string providerName;
164 std::mutex imageMutex;
165 cv::Mat previousImage, old2;
166 std::vector<cv::Point2f> previousFeatures;
167 visionx::ImageProviderInterfacePrx imageProviderPrx;
168 OpticalFlowListenerPrx prx;
169 visionx::ImageDimension imageDimension;
171 float resultX, resultY, timeDiff;
173 Ice::Long previousTime;
175 int chessboardWidth, chessboardHeight;
183 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
static std::string GetDefaultName()
std::string getDefaultName() const override
Retrieve default name of component.
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.