Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

compare two rows of a matrix

Basically, I want to compare two rows from a matrix and return the logic values.

Mat x(240, 320, CV_32F); // 240320 image size Mat pairs(5, 2, CV_8U); // 52 matrix, each row is a pair of row index from x int P = pairs.rows; for (int j=0; j<p; j++)="" {="" z="(x.row(pairs(j,1))" &gt;="" x.row(pairs(j,2)));="" }<="" p="">

It gives the following error,

error C2664: 'cv::Mat cv::Mat::operator ()(const cv::Range *) const' : cannot convert parameter 1 from 'int' to 'const cv::Range *'

How to resolve this issue? Is it because the operator of row(int i) is wrong?

Thanks for your help.

compare two rows of a matrix

Basically, I want to compare two rows from a matrix and return the logic values.

Mat x(240, 320, CV_32F); // 240320 240*320 image size size

Mat pairs(5, 2, CV_8U); // 52 5*2 matrix, each row is a pair of row index from x x

int P = pairs.rows; pairs.rows;

for (int j=0; j<p; j++)="" {="" z="(x.row(pairs(j,1))" &gt;="" x.row(pairs(j,2)));="" }<="" {<="" p="">

z = (x.row(pairs(j,1)) > x.row(pairs(j,2)));

}

It gives the following error,

error C2664: 'cv::Mat cv::Mat::operator ()(const cv::Range *) const' : cannot convert parameter 1 from 'int' to 'const cv::Range *'

How to resolve this issue? Is it because the operator of row(int i) is wrong?

Thanks for your help.

compare two rows of a matrix

Basically, I want to compare two rows from a matrix and return the logic values.

Mat x(240, 320, CV_32F); // 240*320 image size

Mat pairs(5, 2, CV_8U); // 5*2 matrix, each row is a pair of row index from x

int P = pairs.rows;

for (int j=0; j<p; j++)="" {<="" j++)<="" p="">

{

z = (x.row(pairs(j,1)) > x.row(pairs(j,2)));

}

It gives the following error,

error C2664: 'cv::Mat cv::Mat::operator ()(const cv::Range *) const' : cannot convert parameter 1 from 'int' to 'const cv::Range *'

How to resolve this issue? Is it because the operator of row(int i) is wrong?

Thanks for your help.

click to hide/show revision 4
improved code formatting

compare two rows of a matrix

Basically, I want to compare two rows from a matrix and return the logic values.

 Mat x(240, 320, CV_32F); // 240*320 image size

size Mat pairs(5, 2, CV_8U); // 5*2 matrix, each row is a pair of row index from x

x int P = pairs.rows;

pairs.rows; for (int j=0; j<p; j++)<="" p="">

{

j<P; j++) { z = (x.row(pairs(j,1)) > x.row(pairs(j,2)));

}

x.row(pairs(j,2))); }

It gives the following error,

 error C2664: 'cv::Mat cv::Mat::operator ()(const cv::Range *) const' : cannot convert parameter 1 from 'int' to 'const cv::Range *'

*'

How to resolve this issue? Is it because the operator of row(int i) is wrong?

Thanks for your help.