pthom / cvnp

cvnp: pybind11 casts between numpy and OpenCV, with shared memory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python to c++ non-continuous image issue

MichalDN opened this issue · comments

Hello, I have been running into this issue, not sure if I am doing something wrong, or misunderstood the capabilities of your libraries.

on python side following is run:

img2 = cv2.imread('testImg.png',cv2.IMREAD_COLOR)
img3Test = img2[:,:,1]
detector2.showImage(img3Test)

On c++ side this is run

.def("showImage", &PYARobustChessboardDetector::showImage)

void showImage(cv::Mat mat) {
        cv::imshow("Mat", mat);
        cv::waitKey(0);
        cv::destroyAllWindows();
    }

and imshow shows this
ConContinuous

if I enforce continuousness
res4 = detector2.processImage(np.ascontiguousarray(img3Test))
It is as expected

Continuous

I assume your libraries are properly linked, as I would expect error be thrown when I try to load Mat from python, without support.

Though to be fair as I write this, you claim continuous data support, not contiguous so this issue may be outside of the scope of the project.

Hi,
You are right, non contiguous support is out of the scope of the library.
However, I just added an exception, with a nice error message: c1622d6

Could you please try it and tell me if it does work also on your side?

Shame :)
The code compiled and exception worked once I added the missing namespace in front of ssize_t. See pull request, where I added it.