Ask Your Question
0

compare two rows of a matrix

asked 2013-01-23 13:24:29 -0600

southpark gravatar image

updated 2013-01-23 22:19:43 -0600

Haris gravatar image

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++) {
 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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-01-23 22:45:59 -0600

Daniil Osokin gravatar image

Hi! It's because operator() from pairs. Try this:


x.row(pairs.at<unsigned char>(j,0)) > x.row(pairs.at<unsigned char>(j,1))
edit flag offensive delete link more

Comments

Thanks all the same. Later, I also figured out the problem.

southpark gravatar imagesouthpark ( 2013-01-25 07:53:52 -0600 )edit

Question Tools

Stats

Asked: 2013-01-23 13:24:29 -0600

Seen: 1,358 times

Last updated: Jan 23 '13