Passing bitmap from c# to c++

后端 未结 4 1009
后悔当初
后悔当初 2020-12-15 00:59

I have an image processing function written in C++ based on opencv. In my wpf application I have used AForge library to access a webcam and update it on UI. This the functio

4条回答
  •  轮回少年
    2020-12-15 01:49

    An HBITMAP is an opaque handle to a bitmap. It is not a pixel buffer. So your two pieces of code do not match.

    If you pass an HBITMAP to the native code then you need the native code to use GDI functions to obtain the pixel buffer and operate on it. Alternatively you could obtain a pixel buffer in your managed code and pass that to the native code. Whichever way you go you do need to match the two sides of the interop.

提交回复
热议问题