ofxOpencv, using native cv methods

i have to use some of cv methods that take cvMat and to use ofxCvImage i have to do a little workaround:

// pseudocode  
IplImage * origin = ofxCvImage::getCvImage()  
CvMat stub, *dst_mat;  
dst_mat = cvGetMat(src_img, &stub, 0, 0);  
// and then return back from cvMat to IplImage to ofxCvImage  

what is the best way? then, basing on this topic: http://stackoverflow.com/a/5192612/433685

Based on the ‘c++’ tag you have in your question: You should not use it, you should use cv::Mat. Every IplImage is a cv::Mat internally.

IplImage is only used in the C API. It is a kind of CvMat and holds image data. Its name origins from OpenCV roots (Intel IPL).

It is not relevant anymore if you use C++ API of OpenCV.

i thought: why ofxCvImage is based on IplImage and not on cvMat? how can i add some methods that make this kind of “cast” easy?

EDIT: conversion between IplImage and cvMat are grabbed from here: http://wangpengnorman.blogspot.com/2009/06/transform-between-cvmat-and-iplimage.html

OpenCV 2.x methods all use cv::Mat, while older 1.x methods use IplImage or CvArray, both of which aren’t compatible with the new 2.x methods. You might want to take a look at the very excellent ofxCv, which wraps OpenCV 2.0 methods without hiding any of them https://github.com/kylemcdonald/ofxCv