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);
49 setImageSyncMode(visionx::eFpsSynchronization);
50 frameRate = properties.fps;
81 ximg_cv = cv::Mat(properties.height, properties.width, CV_8UC4, ximg->data);
83 auto tmpSharedMemoryProvider = sharedMemoryProvider;
84 if (tmpSharedMemoryProvider)
86 Ice::Byte* pixels =
static_cast<Ice::Byte*
>(out.data);
87 updateTimestamp(clock.now().toMicroSecondsSinceEpoch());
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;