FP Perception 0.1.2
Loading...
Searching...
No Matches
image_analysis_pipeline.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
9
10namespace fp_perception
11{
12
14{
15public:
16 ImageAnalysisPipeline(std::shared_ptr<ImageAnalysisDriver> image_analysis_driver,
17 std::shared_ptr<VisionSourceDriver> ros_vision_driver = nullptr,
18 std::shared_ptr<VisionSourceDriver> non_ros_vision_driver = nullptr)
19 : image_analysis_driver_(std::move(image_analysis_driver))
20 , ros_vision_driver_(std::move(ros_vision_driver))
21 , non_ros_vision_driver_(std::move(non_ros_vision_driver))
22 {
23 }
24
26 {
28 throw fp_perception_exception("Image analysis driver is not loaded.");
29
30 if (request.use_device_vision)
31 {
33 {
34 request.frame = non_ros_vision_driver_->captureFrame();
35 }
36 else if (ros_vision_driver_)
37 {
38 request.frame = ros_vision_driver_->captureFrame();
39 }
40 else
41 {
42 throw fp_perception_exception("use_device_vision requested but no vision driver is loaded");
43 }
44 }
45
46 return image_analysis_driver_->analyze(request);
47 }
48
49private:
50 std::shared_ptr<ImageAnalysisDriver> image_analysis_driver_;
51 std::shared_ptr<VisionSourceDriver> ros_vision_driver_;
52 std::shared_ptr<VisionSourceDriver> non_ros_vision_driver_;
53};
54
55} // namespace fp_perception
Definition image_analysis_pipeline.hpp:14
std::shared_ptr< ImageAnalysisDriver > image_analysis_driver_
Definition image_analysis_pipeline.hpp:50
ImageAnalysisPipeline(std::shared_ptr< ImageAnalysisDriver > image_analysis_driver, std::shared_ptr< VisionSourceDriver > ros_vision_driver=nullptr, std::shared_ptr< VisionSourceDriver > non_ros_vision_driver=nullptr)
Definition image_analysis_pipeline.hpp:16
image_analysis_result run(image_analysis_request request)
Definition image_analysis_pipeline.hpp:25
std::shared_ptr< VisionSourceDriver > non_ros_vision_driver_
Definition image_analysis_pipeline.hpp:52
std::shared_ptr< VisionSourceDriver > ros_vision_driver_
Definition image_analysis_pipeline.hpp:51
Definition audio_buffer.hpp:16
Base class for driver exceptions.
Definition exceptions.hpp:14
Definition structs.hpp:11
vision_frame frame
Definition structs.hpp:12
bool use_device_vision
Definition structs.hpp:14
Definition structs.hpp:18