0

I'm new to OpenCV, and I'm doing something about image stitching.

In the following code I want to know what the perspective transform matrix is and display the matrix, however I am getting the following errors.

//-- Find the Homography
cv::Mat H = cv::findHomography(cv::Mat(vec2),cv::Mat(vec1),CV_RANSAC);
cout << H.at(0,0) <<endl;
karel
  • 5,489
  • 46
  • 45
  • 50
user2567753
  • 39
  • 1
  • 5

2 Answers2

1

To display the matrix, just do std::cout<<H<<std::endl;.

To use cv::Mat::at You need to add type of matrix to the argument (it is a template method). Look here for more info about arguments for cv::Mat::at

Community
  • 1
  • 1
morynicz
  • 2,322
  • 2
  • 20
  • 34
  • I used `std::cout< – user2567753 Jul 10 '13 at 16:27
  • Break? You mean error or what? You can paste the output if it is hard to describe. – morynicz Jul 10 '13 at 20:48
  • I mean an interruption. The results in call stack window as follows.> ConsoleApplication1.exe!cv::operator<<(std::basic_ostream > & out, const cv::Mat & mtx) line 3543 C++ ConsoleApplication1.exe!main() line 123 C++ ConsoleApplication1.exe!__tmainCRTStartup() line 536 C ConsoleApplication1.exe!mainCRTStartup() line 377 C – user2567753 Jul 11 '13 at 04:16
  • I see You are using visual studio. There might be some kind of problem with project setup. You can check if `H` is not empty, and if `cv::Mat(vec1)` and `cv::Mat(vec2)` have the same types. Otherwise I have no idea why it is complaining. The error message tells nothing. – morynicz Jul 11 '13 at 07:49
0

try H.at <double> (i,j)..its works for me....