Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I sort Mat with col order

I have a Mat element, that I want to sort with col oder, so for example I have:

Mat A ={[2 1], [0 2], [1 2], [0 1]}

So, If I use:

cv::sort(A, dst, CV_SORT_EVERY_COLUMN + CV_SORT_ASCENDING);

They will order each column independently, but the expected result is to order the second column first, then if a draw happens it will sort by the first column:

Actual:

{[0 1], [0 1], [1 2], [2 2]}

Expected:

{[0 1], [2 1], [0 2], [1 2]}