How to pass a bitmap to c++ from rust?

I work on rust code, and want to pass a bitmap, like screenshot, to a c++ function where it will be further converted to cv::mat . I think it's not enough to just pass a pointer of the bitmap address and image size, but not sure how to do it. Could anyone give some hint, or example code ?

Well, if that's just the raw data, and you know what format it is in (eg. RGBA, little endian, etc.) then it is enough. Otherwise, it depends on exactly how you are planning to use it.

C++ and Rust will share the same address space, so it is okay to pass pointers.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.