cvmGet equivalent to c++ [closed]

asked 2012-08-17 06:17:01 -0500

yes123 gravatar image

updated 2018-01-18 15:22:07 -0500

I need to convert a function from c to c++. The function looks like:

// Returns whether H is a nice homography matrix or not
bool niceHomography(const CvMat * H)
{
  const double det = cvmGet(H, 0, 0) * cvmGet(H, 1, 1) - cvmGet(H, 1, 0) * cvmGet(H, 0, 1);
  if (det < 0)
    return false;

  //> Some other similar check

  return true;
}

I thought to do:

bool niceHomography(const Mat * H) {


  const double det = H->at<float>(0,0) * H ->at<float>(1, 1) - H->at<float>(1, 0) * H->at<float>(0, 1);
  if (det < 0)
    return false;

}

So converting cvmGet(H,0,0) to H->at<float>(0,0);

Am I doing it right? Is there any faster option?

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by sammy
close date 2012-08-17 06:43:43.354236

Comments

sammy gravatar imagesammy ( 2012-08-17 06:42:48 -0500 )edit