OpenCV  4.10.0-dev
Open Source Computer Vision
Loading...
Searching...
No Matches
Enumerations | Functions
WinRT glue for video I/O

Detailed Description

Enumerations

enum  {
  cv::OPEN_CAMERA = 300 ,
  cv::CLOSE_CAMERA ,
  cv::UPDATE_IMAGE_ELEMENT ,
  cv::SHOW_TRACKBAR
}
 

Functions

void cv::winrt_imshow ()
 
void cv::winrt_onVisibilityChanged (bool visible)
 
void cv::winrt_setFrameContainer (::Windows::UI::Xaml::Controls::Image^ image)
 
template<typename ... Args>
void cv::winrt_startMessageLoop (std::function< void(Args...)> &&callback, Args... args)
 
template<typename ... Args>
void cv::winrt_startMessageLoop (void callback(Args...), Args... args)
 
template void cv::winrt_startMessageLoop (void callback(void))
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

#include <opencv2/videoio/cap_winrt.hpp>

Enumerator
OPEN_CAMERA 
CLOSE_CAMERA 
UPDATE_IMAGE_ELEMENT 
SHOW_TRACKBAR 

Function Documentation

◆ winrt_imshow()

void cv::winrt_imshow ( )

#include <opencv2/videoio/cap_winrt.hpp>

Note
Must be called to update attached image source. Code sample is available for winrt_startMessageLoop().

◆ winrt_onVisibilityChanged()

void cv::winrt_onVisibilityChanged ( bool  visible)

#include <opencv2/videoio/cap_winrt.hpp>

Note
Must be called from WinRT specific callback to handle image grabber state. Here is how the class can be used:
MainPage::MainPage()
{
// ...
Window::Current->VisibilityChanged += ref new Windows::UI::Xaml::WindowVisibilityChangedEventHandler(this, &Application::MainPage::OnVisibilityChanged);
// ...
}
void Application::MainPage::OnVisibilityChanged(Platform::Object ^sender,
Windows::UI::Core::VisibilityChangedEventArgs ^e)
{
}
void winrt_onVisibilityChanged(bool visible)

◆ winrt_setFrameContainer()

void cv::winrt_setFrameContainer ( ::Windows::UI::Xaml::Controls::Image^  image)

#include <opencv2/videoio/cap_winrt.hpp>

Note
Must be called to assign WinRT control holding image you're working with. Code sample is available for winrt_startMessageLoop().

◆ winrt_startMessageLoop() [1/3]

template<typename ... Args>
void cv::winrt_startMessageLoop ( std::function< void(Args...)> &&  callback,
Args...  args 
)

◆ winrt_startMessageLoop() [2/3]

template<typename ... Args>
void cv::winrt_startMessageLoop ( void   callbackArgs...,
Args...  args 
)

◆ winrt_startMessageLoop() [3/3]

template void cv::winrt_startMessageLoop ( void   callbackvoid)

#include <opencv2/videoio/cap_winrt.hpp>

Note
Starts (1) frame-grabbing loop and (2) message loop
  1. Function passed as an argument must implement common OCV reading frames pattern (see cv::VideoCapture documentation) AND call cv::winrt_imgshow().
  2. Message processing loop required to overcome WinRT container and type conversion restrictions. OCV provides default implementation Here is how the class can be used:
    void cvMain()
    {
    Mat frame;
    cam.open(0);
    while (1)
    {
    cam >> frame;
    // don't reprocess the same frame again
    if (!cam.grab()) continue;
    // your processing logic goes here
    // obligatory step to get XAML image component updated
    }
    }
    MainPage::MainPage()
    {
    InitializeComponent();
    }
    n-dimensional dense array class
    Definition mat.hpp:828
    Class for video capturing from video files, image sequences or cameras.
    Definition videoio.hpp:735
    virtual bool open(const String &filename, int apiPreference=CAP_ANY)
    Opens a video file or a capturing device or an IP video stream for video capturing.
    virtual bool grab()
    Grabs the next frame from video file or capturing device.
    void winrt_setFrameContainer(::Windows::UI::Xaml::Controls::Image^ image)
    void winrt_startMessageLoop(std::function< void(Args...)> &&callback, Args... args)
    void winrt_imshow()