1 | initial version |
The result of OpenCV is absolutely correct! Each column is sorted individually.
If you want to sort by the second column you need to use cv::sortIdx()
on the second column only ( you can use .col(1)
) and then use these indices, i.e. create a new matrix and copy each row from A to the new matrix according to this index.