OpenCV  3.4.12
Open Source Computer Vision
Functions
WinRT support

Functions

void cv::winrt_initContainer (::Windows::UI::Xaml::Controls::Panel^ container)
 Initializes container component that will be used to hold generated window content. More...
 

Detailed Description

This figure explains new functionality implemented with WinRT GUI. The new GUI provides an Image control, and a slider panel. Slider panel holds trackbars attached to it.

Sliders are attached below the image control. Every new slider is added below the previous one.

See below the example used to generate the figure:

void sample_app::MainPage::ShowWindow()
{
static cv::String windowName("sample");
cv::winrt_initContainer(this->cvContainer);
cv::namedWindow(windowName); // not required
cv::Mat image = cv::imread("Assets/sample.jpg");
cv::Mat converted = cv::Mat(image.rows, image.cols, CV_8UC4);
cv::cvtColor(image, converted, COLOR_BGR2BGRA);
cv::imshow(windowName, converted); // this will create window if it hasn't been created before
int state = 42;
cv::TrackbarCallback callback = [](int pos, void* userdata)
{
if (pos == 0) {
cv::destroyWindow(windowName);
}
};
cv::TrackbarCallback callbackTwin = [](int pos, void* userdata)
{
if (pos >= 70) {
}
};
cv::createTrackbar("Sample trackbar", windowName, &state, 100, callback);
cv::createTrackbar("Twin brother", windowName, &state, 100, callbackTwin);
}

Function Documentation

◆ winrt_initContainer()

void cv::winrt_initContainer ( ::Windows::UI::Xaml::Controls::Panel^  container)

#include <opencv2/highgui/highgui_winrt.hpp>

Initializes container component that will be used to hold generated window content.

Parameters
containerContainer (Panel^) reference that will be used to hold generated window content: controls and image.
Note
Must be called to assign WinRT container that will hold created windows content.