Vulkan OpenCV video capture source. More...
#include <mxvk/include/mxvk/mxvk_cv.hpp>
Public Member Functions | |
| void | close () |
| Close the capture device. | |
| bool | createImage (VkDevice device, VkPhysicalDevice physDev, VkQueue gQueue, VkCommandPool cmdPool, size_t width, size_t height, const std::string &vert, const std::string &frag) |
| Allocate the VKSprite and upload the initial texture. | |
| void | draw (int x, int y) |
| Draw using the sprite's native dimensions. | |
| void | draw (int x, int y, int width, int height) |
| Draw the current frame at a specified position and size. | |
| double | get (unsigned int option) |
| Query a VideoCapture property. | |
| VK_Sprite * | getSprite () |
| Access the backing sprite. | |
| bool | is_open () const |
| Check whether the capture device is open. | |
| bool | open (const std::string &filename) |
| Open a video file. | |
| bool | open (int id, int mode=0) |
| Open a camera device. | |
| VK_Capture & | operator= (const VK_Capture &)=delete |
| VK_Capture & | operator= (VK_Capture &&)=delete |
| bool | read () |
| Capture and upload the next video frame. | |
| bool | read (cv::Mat &frame) |
| Capture the next frame into a cv::Mat. | |
| bool | readRgba (cv::Mat &rgba, bool flipY=false) |
| bool | readToModelTexture (VKAbstractModel &model, bool flipY=false) |
| bool | readToSprite (VK_Sprite &targetSprite) |
| bool | readToSprite (VK_Sprite &targetSprite, bool flipY) |
| bool | reload (size_t width, size_t height, const std::string &vert, const std::string &frag) |
| Replace the vertex/fragment shaders. | |
| void | resetSprite () |
| Destroy the current sprite and its Vulkan resources. | |
| void | set (unsigned int option, double value) |
| Set a VideoCapture property. | |
| VK_Capture ()=default | |
| Default constructor. | |
| VK_Capture (const VK_Capture &)=delete | |
| VK_Capture (VK_Capture &&)=delete | |
| ~VK_Capture ()=default | |
| Destructor. | |
Vulkan OpenCV video capture source.
Opens a video file or camera, decodes frames, and uploads them to a VKSprite texture for Vulkan-accelerated rendering inside a VKWindow.
Definition at line 30 of file mxvk_cv.hpp.
|
default |
Default constructor.
|
default |
Destructor.
|
delete |
|
delete |
| void mxvk::VK_Capture::close | ( | ) |
Close the capture device.
Definition at line 37 of file mxvk_cv.cpp.
| bool mxvk::VK_Capture::createImage | ( | VkDevice | device, |
| VkPhysicalDevice | physDev, | ||
| VkQueue | gQueue, | ||
| VkCommandPool | cmdPool, | ||
| size_t | width, | ||
| size_t | height, | ||
| const std::string & | vert, | ||
| const std::string & | frag ) |
Allocate the VKSprite and upload the initial texture.
| device | Logical Vulkan device. |
| physDev | Physical device. |
| gQueue | Graphics queue. |
| cmdPool | Command pool. |
| width | Display width. |
| height | Display height. |
| vert | Vertex shader path. |
| frag | Fragment shader path. |
true on success. Definition at line 46 of file mxvk_cv.cpp.
| void mxvk::VK_Capture::draw | ( | int | x, |
| int | y ) |
Draw using the sprite's native dimensions.
| x | Destination X. |
| y | Destination Y. |
Definition at line 476 of file mxvk_cv.cpp.
| void mxvk::VK_Capture::draw | ( | int | x, |
| int | y, | ||
| int | width, | ||
| int | height ) |
Draw the current frame at a specified position and size.
| x | Width destination X. |
| y | Width destination Y. |
| width | Display width. |
| height | Display height. |
Definition at line 471 of file mxvk_cv.cpp.
| double mxvk::VK_Capture::get | ( | unsigned int | option | ) |
Query a VideoCapture property.
| option | cv::VideoCaptureProperties constant. |
Definition at line 485 of file mxvk_cv.cpp.
|
inline |
Access the backing sprite.
Definition at line 93 of file mxvk_cv.hpp.
|
inline |
Check whether the capture device is open.
true if the VideoCapture is opened. Definition at line 71 of file mxvk_cv.hpp.
| bool mxvk::VK_Capture::open | ( | const std::string & | filename | ) |
Open a video file.
| filename | Path to the video file. |
true on success. Definition at line 14 of file mxvk_cv.cpp.
| bool mxvk::VK_Capture::open | ( | int | id, |
| int | mode = 0 ) |
Open a camera device.
| id | Camera index. |
| mode | Backend hint (0 = auto). |
true on success. Definition at line 23 of file mxvk_cv.cpp.
|
delete |
|
delete |
| bool mxvk::VK_Capture::read | ( | ) |
Capture and upload the next video frame.
true if a frame was available. Definition at line 456 of file mxvk_cv.cpp.
| bool mxvk::VK_Capture::read | ( | cv::Mat & | frame | ) |
Capture the next frame into a cv::Mat.
| frame | Output matrix. |
true if a frame was available. Definition at line 70 of file mxvk_cv.cpp.
| bool mxvk::VK_Capture::readRgba | ( | cv::Mat & | rgba, |
| bool | flipY = false ) |
Definition at line 74 of file mxvk_cv.cpp.
| bool mxvk::VK_Capture::readToModelTexture | ( | VKAbstractModel & | model, |
| bool | flipY = false ) |
Definition at line 298 of file mxvk_cv.cpp.
| bool mxvk::VK_Capture::readToSprite | ( | VK_Sprite & | targetSprite | ) |
Definition at line 369 of file mxvk_cv.cpp.
| bool mxvk::VK_Capture::readToSprite | ( | VK_Sprite & | targetSprite, |
| bool | flipY ) |
Definition at line 378 of file mxvk_cv.cpp.
| bool mxvk::VK_Capture::reload | ( | size_t | width, |
| size_t | height, | ||
| const std::string & | vert, | ||
| const std::string & | frag ) |
Replace the vertex/fragment shaders.
| width | Display width. |
| height | Display height. |
| vert | New vertex shader path. |
| frag | New fragment shader path. |
true on success. Definition at line 57 of file mxvk_cv.cpp.
| void mxvk::VK_Capture::resetSprite | ( | ) |
Destroy the current sprite and its Vulkan resources.
Call this before swapchain/command-pool teardown to avoid destroying sprite staging command buffers against an invalid command pool.
Definition at line 42 of file mxvk_cv.cpp.
| void mxvk::VK_Capture::set | ( | unsigned int | option, |
| double | value ) |
Set a VideoCapture property.
| option | cv::VideoCaptureProperties constant. |
| value | Desired value. |
Definition at line 481 of file mxvk_cv.cpp.