OpenCV library is binary compatible inside 2.4 branch, so you can exchange library and use several impls of OpenCV. But OpenCV 3.0.0 from master is binary incompatible with 2.4.x branch. It means that cv::Mat and other data types can have and actually have different memory layout. So, you cannot pass cv::Mat from 2.4.x to 3.0.0. I recommend you to port your legacy code on 3.0.0. From my poit of view it is easier then integrate to different library versions.