Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I remove duplicate rows in cv::Mat?

I have four n x 2 matrices and I want to concatenate them, but removing the duplicate rows. I tried to use std::set

std::set<cv::Mat> nonDuplicatedPairs;
for (int i = 0; i < drPairs.rows; ++i) {
    nonDuplicatedPairs.insert( deltasMat.row(i) );
    nonDuplicatedPairs.insert( drPairs.row(i) );
    nonDuplicatedPairs.insert( dlPairs.row(i) );
    nonDuplicatedPairs.insert( ulPairs.row(i) );
}

but it gives the following compilation error:

error C2440: 'return' : cannot convert from 'cv::MatExpr' to 'bool'

These matrices are of type CV_32SC and have only one channel.

click to hide/show revision 2
retagged

updated 2013-10-14 13:06:58 -0600

berak gravatar image

How do I remove duplicate rows in cv::Mat?

I have four n x 2 matrices and I want to concatenate them, but removing the duplicate rows. I tried to use std::set

std::set<cv::Mat> nonDuplicatedPairs;
for (int i = 0; i < drPairs.rows; ++i) {
    nonDuplicatedPairs.insert( deltasMat.row(i) );
    nonDuplicatedPairs.insert( drPairs.row(i) );
    nonDuplicatedPairs.insert( dlPairs.row(i) );
    nonDuplicatedPairs.insert( ulPairs.row(i) );
}

but it gives the following compilation error:

error C2440: 'return' : cannot convert from 'cv::MatExpr' to 'bool'

These matrices are of type CV_32SC and have only one channel.