11 const std::string X11ScreenCaptureImageProvider::defaultName =
"X11ScreenCapture";
38 display = XOpenDisplay(
nullptr);
42 window = RootWindow(
display, properties.screenNumber);
47 setImageFormat(ImageDimension(properties.width, properties.height),
49 visionx::eBayerPatternGr);
51 out = cv::Mat(properties.height, properties.width, CV_8UC3);
53 setImageSyncMode(visionx::eFpsSynchronization);
54 frameRate = properties.fps;
87 ximg_cv = cv::Mat(properties.height, properties.width, CV_8UC4, ximg->data);
89 auto tmpSharedMemoryProvider = sharedMemoryProvider;
90 if (tmpSharedMemoryProvider)
92 Ice::Byte* pixels =
static_cast<Ice::Byte*
>(out.data);
93 updateTimestamp(clock.now().toMicroSecondsSinceEpoch());
94 cv::cvtColor(ximg_cv, out, cv::COLOR_RGBA2BGR);
96 tmpSharedMemoryProvider->getScopedWriteLock());
97 memcpy(ppImageBuffers[0], pixels, out.cols * out.rows * out.channels());
107 properties.fps =
static_cast<int>(framesPerSecond);
124 defs->optional(properties.screenNumber,
"screen.number",
"Screen number to record. This does not correspond to "
125 "the monitor count, as this is transparent to X. You "
126 "don't want to change this in most cases.");
127 defs->optional(properties.fps,
"fps",
"Frames per second.");
128 defs->optional(properties.x,
"region.x",
"X coordinate of the region to record.");
129 defs->optional(properties.y,
"region.y",
"Y coordinate of the region to record.");
130 defs->optional(properties.width,
"region.width",
"Width of the region to record.");
131 defs->optional(properties.height,
"region.height",
"Height of the region to record.");
137 std::vector<imrec::ChannelPreferences>
142 imrec::ChannelPreferences cp;
143 cp.requiresLossless =
false;