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
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.