10 const std::string X11ScreenCaptureImageProvider::defaultName =
"X11ScreenCapture";
34 display = XOpenDisplay(
nullptr);
38 window = RootWindow(display, properties.screenNumber);
43 setImageFormat(ImageDimension(properties.width, properties.height),
45 visionx::eBayerPatternGr);
47 out = cv::Mat(properties.height, properties.width, CV_8UC3);
62 XCloseDisplay(display);
73 ximg = XGetImage(display,
81 ximg_cv = cv::Mat(properties.height, properties.width, CV_8UC4, ximg->data);
84 if (tmpSharedMemoryProvider)
86 Ice::Byte* pixels =
static_cast<Ice::Byte*
>(out.data);
88 cv::cvtColor(ximg_cv, out, cv::COLOR_RGBA2BGR);
90 tmpSharedMemoryProvider->getScopedWriteLock());
91 memcpy(ppImageBuffers[0], pixels, out.cols * out.rows * out.channels());
100 properties.fps =
static_cast<int>(framesPerSecond);
115 defs->optional(properties.screenNumber,
117 "Screen number to record. This does not correspond to "
118 "the monitor count, as this is transparent to X. You "
119 "don't want to change this in most cases.");
120 defs->optional(properties.fps,
"fps",
"Frames per second.");
121 defs->optional(properties.x,
"region.x",
"X coordinate of the region to record.");
122 defs->optional(properties.y,
"region.y",
"Y coordinate of the region to record.");
123 defs->optional(properties.width,
"region.width",
"Width of the region to record.");
124 defs->optional(properties.height,
"region.height",
"Height of the region to record.");
129 std::vector<imrec::ChannelPreferences>
134 imrec::ChannelPreferences cp;
135 cp.requiresLossless =
false;
Default component property definition container.
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Clock to get date/time from a specific clock type or wait for certain durations or until certain date...
float frameRate
Required frame rate.
void setImageSyncMode(ImageSyncMode imageSyncMode)
Sets the image synchronization mode.
armarx::IceSharedMemoryProvider< unsignedchar >::pointer_type sharedMemoryProvider
shared memory provider
void updateTimestamp(Ice::Long timestamp, bool threadSafe=true)
Updates the timestamp of the currently captured image.
void setImageFormat(ImageDimension imageDimension, ImageType imageType, BayerPatternType bayerPatternType=visionx::eBayerPatternRg)
Sets the image basic format data.
void setNumberImages(int numberImages)
Sets the number of images on each capture.
X11ScreenCaptureImageProvider()
void onStartCapture(float framesPerSecond) override
This is called when the image provider capturing has been started.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onStopCapture() override
This is called when the image provider capturing has been stopped.
void onExitCapturingImageProvider() override
This is called when the Component::onExitComponent() setup is called.
static std::string GetDefaultName()
std::vector< imrec::ChannelPreferences > getImageRecordingChannelPreferences(const Ice::Current &) override
void onInitCapturingImageProvider() override
This is called when the Component::onInitComponent() is called.
std::string getDefaultName() const override
Retrieve default name of component.
#define ARMARX_CHECK_LESS(lhs, rhs)
This macro evaluates whether lhs is less (<) than rhs and if it turns out to be false it will throw a...
#define ARMARX_CHECK_GREATER_EQUAL(lhs, rhs)
This macro evaluates whether lhs is greater or equal (>=) rhs and if it turns out to be false it will...
#define ARMARX_INFO
The normal logging level.
std::shared_ptr< SharedMemoryScopedWriteLock > SharedMemoryScopedWriteLockPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.