Reputation: 55
I am using OpenCV's remap
function as shown below:
Mat lg,lr;
Mat *mxl = (Mat *) cvLoad("mx1.xml");
Mat *myl = (Mat *) cvLoad("my1.xml");
remap(lg, lr, mxl, myl);
mx1
and my1
are loaded as cv::Mat
, but remap
needs cv::_InputArray
, how do I achieve this?
Upvotes: 1
Views: 463
Reputation: 11329
cv::_InputArray
is a proxy type used by OpenCV to accept multiple data types (like cv::Mat
or std::vector
) as inputs. You don't need to create one directly.
Part of your problem is that you're attempting to mix the C and C++ APIs. This is not recommended. Another factor is that cv::Mat*
cannot be converted to InputArray
. You can use cv::FileStorage
to read your files into cv::Mat
objects:
cv::Mat lg, lr;
cv::FileStorage fs1("mx1.xml", cv::FileStorage::READ);
cv::FileStorage fs2("mx2.xml", cv::FileStorage::READ);
cv::Mat mxl;
cv::FileNode fn = fs1.getFirstTopLevelNode();
fn >> mxl;
cv::Mat myl;
fn = fs2.getTopLevelNode();
fn >> myl;
cv::remap(lg, lr, mxl, myl, CV_INTER_LINEAR);
Upvotes: 2