Loading...
Searching...
No Matches
WinRT glue for video I/O
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)) |
Detailed Description
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){cv::winrt_onVisibilityChanged(e->Visible);}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 | ||
) |
#include <opencv2/videoio/cap_winrt.hpp>
◆ winrt_startMessageLoop() [2/3]
template<typename ... Args>
void cv::winrt_startMessageLoop | ( | void | callbackArgs..., |
Args... | args | ||
) |
#include <opencv2/videoio/cap_winrt.hpp>
◆ 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
- Function passed as an argument must implement common OCV reading frames pattern (see cv::VideoCapture documentation) AND call cv::winrt_imgshow().
- 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;VideoCapture cam;cam.open(0);while (1){cam >> frame;// don't reprocess the same frame again// your processing logic goes here// obligatory step to get XAML image component updatedwinrt_imshow();}}MainPage::MainPage(){InitializeComponent();cv::winrt_setFrameContainer(cvImage);cv::winrt_startMessageLoop(cvMain);}Class for video capturing from video files, image sequences or cameras.Definition: videoio.hpp:728virtual 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.void winrt_setFrameContainer(::Windows::UI::Xaml::Controls::Image^ image)void winrt_startMessageLoop(std::function< void(Args...)> &&callback, Args... args)void winrt_imshow()