X11ScreenCaptureImageProvider.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <opencv2/opencv.hpp>
4 
6 
8 
9 // Include X last.
10 #include <X11/Xlib.h>
11 #include <X11/Xutil.h>
12 
13 
14 namespace visionx
15 {
16 
18  {
19  public:
21 
22  // ManagedIceObject interface
23  protected:
24  std::string getDefaultName() const override;
25  static std::string GetDefaultName();
26 
27  // CapturingImageProviderInterface interface
28  public:
29  // CapturingImageProvider interface
30  protected:
31  void onInitCapturingImageProvider() override;
32  void onExitCapturingImageProvider() override;
33  bool capture(void** ppImageBuffers) override;
34 
35  // CapturingImageProvider interface
36  protected:
37  void onStartCapture(float framesPerSecond) override;
38  void onStopCapture() override;
39 
40  // PropertyUser interface
41  public:
43 
44  std::vector<imrec::ChannelPreferences>
45  getImageRecordingChannelPreferences(const Ice::Current&) override;
46 
47  private:
48  static const std::string defaultName;
49 
50  struct Properties
51  {
52  int screenNumber = 0;
53  int x = 0;
54  int y = 0;
55  int width = 1920;
56  int height = 1080;
57  int fps = 30;
58  } properties;
59 
60  armarx::Clock clock;
61 
62  Window window;
63  Display* display;
64  XImage* ximg = nullptr;
65  cv::Mat ximg_cv;
66  cv::Mat out;
67  };
68 
69 } // namespace visionx
visionx::X11ScreenCaptureImageProvider::onInitCapturingImageProvider
void onInitCapturingImageProvider() override
This is called when the Component::onInitComponent() is called.
Definition: X11ScreenCaptureImageProvider.cpp:34
visionx::Display
Definition: Display.h:36
visionx::X11ScreenCaptureImageProvider
Definition: X11ScreenCaptureImageProvider.h:17
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::X11ScreenCaptureImageProvider::onStartCapture
void onStartCapture(float framesPerSecond) override
This is called when the image provider capturing has been started.
Definition: X11ScreenCaptureImageProvider.cpp:105
visionx::X11ScreenCaptureImageProvider::getImageRecordingChannelPreferences
std::vector< imrec::ChannelPreferences > getImageRecordingChannelPreferences(const Ice::Current &) override
Definition: X11ScreenCaptureImageProvider.cpp:138
armarx::core::time::Clock
Clock to get date/time from a specific clock type or wait for certain durations or until certain date...
Definition: Clock.h:26
Clock.h
visionx::X11ScreenCaptureImageProvider::onExitCapturingImageProvider
void onExitCapturingImageProvider() override
This is called when the Component::onExitComponent() setup is called.
Definition: X11ScreenCaptureImageProvider.cpp:60
visionx::X11ScreenCaptureImageProvider::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: X11ScreenCaptureImageProvider.cpp:20
visionx::CapturingImageProvider::capture
virtual void capture()
Definition: CapturingImageProvider.cpp:106
visionx::CapturingImageProvider
The CapturingImageProvider provides a callback function to trigger the capturing of images with diffe...
Definition: CapturingImageProvider.h:52
visionx::X11ScreenCaptureImageProvider::onStopCapture
void onStopCapture() override
This is called when the image provider capturing has been stopped.
Definition: X11ScreenCaptureImageProvider.cpp:112
visionx::X11ScreenCaptureImageProvider::X11ScreenCaptureImageProvider
X11ScreenCaptureImageProvider()
Definition: X11ScreenCaptureImageProvider.cpp:13
visionx::X11ScreenCaptureImageProvider::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: X11ScreenCaptureImageProvider.cpp:119
CapturingImageProvider.h
IceUtil::Handle< class PropertyDefinitionContainer >
visionx::X11ScreenCaptureImageProvider::GetDefaultName
static std::string GetDefaultName()
Definition: X11ScreenCaptureImageProvider.cpp:27