YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
argusCameraDriver.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2006-2024 Istituto Italiano di Tecnologia (IIT)
3 * All rights reserved.
4 *
5 * This software may be modified and distributed under the terms of the
6 * BSD-3-Clause license. See the accompanying LICENSE file for details.
7 */
8
9#ifndef ARGUS_DRIVER_H
10#define ARGUS_DRIVER_H
11
12#include <Argus/Argus.h>
13#include <Argus/Ext/SyncSensorCalibrationData.h>
14#include <EGLStream/EGLStream.h>
15#include <EGLStream/NV/ImageNativeBuffer.h>
16#include <EGLStream/NV/NvBufSurface.h>
17
19
25#include <yarp/os/Stamp.h>
26#include <yarp/sig/Matrix.h>
27#include <yarp/sig/all.h>
28#include <yarp/cv/Cv.h>
29
30#include <opencv2/opencv.hpp>
31
32#include <cstring>
33#include <iostream>
34#include <map>
35#include <memory>
36#include <mutex>
37#include <typeinfo>
38
39namespace
40{
41YARP_LOG_COMPONENT(ARGUS_CAMERA, "yarp.device.argusCamera")
42}
43
49{
50 public:
51 argusCameraDriver() = default;
52 ~argusCameraDriver() override = default;
53
54 // DeviceDriver
55 bool open(yarp::os::Searchable& config) override;
56 bool close() override;
57
58 // IRgbVisualParams
59 int getRgbHeight() override;
60 int getRgbWidth() override;
62 bool getRgbResolution(int& width, int& height) override;
63 bool setRgbResolution(int width, int height) override;
64 bool getRgbFOV(double& horizontalFov, double& verticalFov) override;
65 bool setRgbFOV(double horizontalFov, double verticalFov) override;
66 bool getRgbMirroring(bool& mirror) override;
67 bool setRgbMirroring(bool mirror) override;
68 bool getRgbIntrinsicParam(yarp::os::Property& intrinsic) override;
69
70 // IFrameGrabberControls
71 bool getCameraDescription(CameraDescriptor* camera) override;
72 bool hasFeature(int feature, bool* hasFeature) override;
73 bool setFeature(int feature, double value) override;
74 bool getFeature(int feature, double* value) override;
75 bool setFeature(int feature, double value1, double value2) override;
76 bool getFeature(int feature, double* value1, double* value2) override;
77 bool hasOnOff(int feature, bool* HasOnOff) override;
78 bool setActive(int feature, bool onoff) override;
79 bool getActive(int feature, bool* isActive) override;
80 bool hasAuto(int feature, bool* hasAuto) override;
81 bool hasManual(int feature, bool* hasManual) override;
82 bool hasOnePush(int feature, bool* hasOnePush) override;
83 bool setMode(int feature, FeatureMode mode) override;
84 bool getMode(int feature, FeatureMode* mode) override;
85 bool setOnePush(int feature) override;
86
87 // IFrameGrabberImage
89 int height() const override;
90 int width() const override;
91
92 private:
93 bool setFramerate(const uint64_t _fps);
94 bool startCamera();
95 bool stopCamera();
96
97 mutable std::mutex m_mutex;
98 uint64_t m_fps{90};
99 cv::Mat rgba_img, bgr_img;
100#ifdef USE_CUDA
101 cv::cuda::GpuMat gpu_rgba_img, gpu_bgr_img;
102#endif
103
104 Argus::UniqueObj<Argus::CameraProvider> m_cameraProvider;
105 Argus::UniqueObj<Argus::OutputStream> m_stream;
106 Argus::UniqueObj<Argus::OutputStreamSettings> m_streamSettings;
107 Argus::UniqueObj<Argus::Request> m_request;
108 Argus::UniqueObj<Argus::CaptureSession> m_captureSession;
109 Argus::UniqueObj<EGLStream::FrameConsumer> m_consumer;
110 std::vector<Argus::CameraDevice*> m_cameraDevices;
111 Argus::ISourceSettings *m_iSourceSettings;
112 Argus::IAutoControlSettings *m_iAutoControlSettings;
113 Argus::IEdgeEnhanceSettings *m_iEdgeEnhanceSettings;
114};
115#endif // ARGUS_DRIVER_H
contains the definition of a Matrix type
This class is the parameters parser for class argusCameraDriver.
int getRgbHeight() override
Return the height of each frame.
bool hasAuto(int feature, bool *hasAuto) override
bool close() override
Close the DeviceDriver.
bool setRgbFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the rgb camera.
bool getActive(int feature, bool *isActive) override
bool getRgbResolution(int &width, int &height) override
Get the resolution of the rgb image from the camera.
bool getMode(int feature, FeatureMode *mode) override
bool setRgbMirroring(bool mirror) override
Set the mirroring setting of the sensor.
bool setRgbResolution(int width, int height) override
Set the resolution of the rgb image from the camera.
bool getRgbSupportedConfigurations(yarp::sig::VectorOf< yarp::dev::CameraConfig > &configurations) override
int height() const override
Return the height of each frame.
bool setFeature(int feature, double value) override
int getRgbWidth() override
Return the width of each frame.
bool getCameraDescription(CameraDescriptor *camera) override
bool getRgbMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
bool getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
Get an image from the frame grabber.
~argusCameraDriver() override=default
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool hasManual(int feature, bool *hasManual) override
bool hasOnePush(int feature, bool *hasOnePush) override
bool hasFeature(int feature, bool *hasFeature) override
int width() const override
Return the width of each frame.
bool setMode(int feature, FeatureMode mode) override
bool setActive(int feature, bool onoff) override
bool hasOnOff(int feature, bool *HasOnOff) override
bool getFeature(int feature, double *value) override
argusCameraDriver()=default
bool setOnePush(int feature) override
bool getRgbFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the rgb camera.
bool getRgbIntrinsicParam(yarp::os::Property &intrinsic) override
Get the intrinsic parameters of the rgb camera.
Interface implemented by all device drivers.
Control interface for frame grabber devices.
An interface for retrieving intrinsic parameter from a rgb camera.
A class for storing options and configuration information.
Definition Property.h:33
A base class for nested structures that can be searched.
Definition Searchable.h:31
Typed image class.
Definition Image.h:603
#define YARP_LOG_COMPONENT(name,...)