Ask Your Question

Revision history [back]

Matlab Bindings Bridge Class Core OpenCV Conversion

The explicit conversion from Bridge object to cv::Size does not appear to be working properly for me. The method is defined in the Bridge.hpp file as:

cv::Size toSize() const { return cv::Size(); }

When I call this method from a properly parsed bridge object I get back a new cv:Size object that has been initialized (by the default constructor) to a width and height of zero. There does not appear to be any marshaling of the MxArray data into this new Size object. The return statement in the method above is simply instantiating a new Size object.

In contrast, the explicit integral type conversion:

int toInt() { return ptr_.scalar< int >(); }

Properly returns the MxArray scalar value when called, as can be seen by the MxArray call to 'scalar< int >'.

I guess my point is that the integral conversion actually does something with the MxArray pointer to convert the data type, while the cv::Size conversion simply returns a new instance of the core object. Is there an overload of the core OpenCV type that I'm not seeing? Or did my Bridge class not get properly generated? This problem occurs to all the core OpenCV type conversion.

I’m using Matlab 2013a, Visual Studio 2010, openCV 3.0 dev, and winxp x86. Any insight would be greatly appreciated. Thank you.