Reputation: 205
I am trying to generate a cv::Mat C from two other matrices in order to get a third matrix that is made by 2-D points generated by combining 1-D points of matrices A and B.
My problem is that everything I tried only concatenates the matrices, and does not really merge each point with another, which would result in a 3-D matrix of 2-D points.
Does anyone can help me with this issue?
Thank you so much.
Just to be more clear:
What I have is A = [(0, 1, 2),(3, 4, 5)]
and B=[(5, 4, 3),(2, 1, 0)]
and I would like to create
C = {[(0,5), (1,4), (2,3)],
[(3,2), (4,1), (5,0)]}.
Thank you
Upvotes: 1
Views: 2477
Reputation: 403
You can do this by creating a custom type matrix. See here
Basically, you need to create a specialization of DataType
class that handles points (pairs of data).
Or you can use the given matrices of std::complex<double>
instead of integers as an ugly shortcut. Example code in the documentation:
Mat B = Mat_<std::complex<double> >(3, 3);
However, this solution might not be the real solution to your general problem. Google XY problem.
Upvotes: 1