twistedfall / opencv-rust

Rust bindings for OpenCV 3 & 4
MIT License
1.86k stars 144 forks source link

Add support for DirectX Interop on Windows #553

Closed modelflat closed 2 months ago

modelflat commented 3 months ago

Hi and thanks for the library! This PR aims to add support for OpenCV's DirectX interoperability API with help of windows crate when building on Windows.

As a first step, I was able to add a rudimentary manual support for a couple of functions, and verified that it works in scope of another project (planning to add a minimal example here later). I suspect there should be a way to make bindings-generator to implement these APIs automatically; for example, get_type_from_d3d_format function is already there. It seems that the main reason the rest of cv::directx namespace are not picked up is that DirectX types get excluded during entity discover phase. However, I'm not sure what is the best way of making them included. I'd appreciate any help/pointers on this!

twistedfall commented 3 months ago

Automatic generation should definitely be possible. I’ll take a look into why this doesn’t happen automatically.

twistedfall commented 2 months ago

Can you please check the directx branch and say if it works for you? The corresponding functions should be generated automatically now

twistedfall commented 2 months ago

This is now part of 0.91.2 release

modelflat commented 1 month ago

@twistedfall Thank you very much for jumping onto this! It works for me now.