Ask Your Question

cv::Matx, copy section to another Matx

asked 2017-04-02 14:03:12 -0500

stillNovice gravatar image

I am porting some code from one project to another. One uses cv::Mat objects, and the other uses cv::Matx.

With Mat, I have:

cvImuMatrix.copyTo(imuPoseOut.rowRange(0, 3).colRange(0, 3));

cvImuMatrix and imuPoseOut are both:

cv::Mat imuPoseOut = cv::Mat::eye(4, 4, CV_32F);

I have not used Matx much, so my questions are:

What do these two lines need to be when using cv::Matx44d?

cv::Mat imuPoseOut = cv::Mat::eye(4, 4, CV_32F); //needs to be cv::Matx44d.
cvImuMatrix.copyTo(imuPoseOut.rowRange(0, 3).colRange(0, 3));

(Neither copyTo, nor rowrange seem to be included in Matx)

Thank you!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-04-03 01:28:00 -0500

berak gravatar image

it's a bit unfortunate, but since Matx has "fixed" memory, it does indeed not support ROI or Range operations.

you can copy your Matx types to "ordinary" Mats, but careful, this is a copy, it won't affect the original Matx.

i guess, you'll have to fall back and assign single elements like

Matx44f a, b;
a(0,0) = b(0,0);
a(0,1) = b(0,1);
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-04-02 14:03:12 -0500

Seen: 375 times

Last updated: Apr 03 '17