kyamagu / mexplus

C++ Matlab MEX development kit.
Other
99 stars 49 forks source link

Fusing mexplus with mexopencv #7

Closed jbriales closed 9 years ago

jbriales commented 9 years ago

I need to use cv::Mat objects, for example, and I suppose it can be also done defining new ::from and ::to methods in MxArray. However, I would like to know if there is any way I could directly use the mexopencv wrapper to use opencv objects from mexplus too.

kyamagu commented 9 years ago

Well, the mexplus library is built after mexopencv project, and both projects have a data conversion API named MxArray though the design and implementation is different. I haven't had time to implement a reference cv::Mat converter for mexplus, but it shouldn't be difficult to port the implementation from mexopencv.

Also, if you just want to use mexopencv, you can directly use that with mexplus without any problem, as long as you properly use mexplus:: namescope. Just build the mexopencv library beforehand, specify the MxArray.hpp header in your code, and link to libMxArray.a when compiling. The MxArray library in mexopencv looks like this:

cv::Mat mat = MxArray(prhs[0]).toMat();
plhs[0] = MxArray(mat);
jbriales commented 9 years ago

I just copied the code you used in mexopencv to implement the corresponding ::from method in mexplus. Thank you for your support!

patrikhuber commented 7 years ago

@jbriales, would you be willing to share your file with the cv::Mat ::from and ::to methods for mexplus? Thanks!

jbriales commented 7 years ago

Hi @patrikhuber it's been a while since I last used this package, but I will try to find it when a get a spare moment and commit it!

patrikhuber commented 7 years ago

@jbriales Thank you, much appreciated! (You can also just upload them to a gist or something and I can then compile them with mexplus.)