Create image in Python from C pointer (openCV Mat return from C DLL)

Without giving you all details (DLL, wrapper C and code C++), I am using the OpenCV library in my DLL to perform some operations on images. For now, I am using four methods of this library : threshold, adaptivethreshold, filter2D and GaussianBlur. In Python I succeeded to recreate image from the function which return the result of the threshold method but from the other I have some shifts (different for each methods and different values of the same parameter on the same method). My DLL return an unsigned short * pointer because I deal with uint8/16 images.

Moreover, if I call these functions using the different OpenCV methods from a C++ program, I get a correct image without shift.

For example, on Python, I recreate the image from the pointer return by the filter2D function using :

I don't know if it comes from my way to recreate an image from a pointer on Python, or maybe some OpenCV function rearrange data and so my Python function works correctly but with data in a different order than usual.