我用来编译和运行Features2D + Homography中的代码来找到一个已知的对象教程,我得到了这个
OpenCV Error: Assertion failed (npoints >= 0 && points2.checkVector(2) == npoint
s && points1.type() == points2.type()) in unknown function, file c:\Users\vp\wor
k\ocv\opencv\modules\calib3d\src\fundam.cpp, line 1062
Run Code Online (Sandbox Code Playgroud)
运行时错误.调试后我发现程序在findHomography函数崩溃了.
Unhandled exception at 0x760ab727 in OpenCVTemplateMatch.exe: Microsoft C++ exception: cv::Exception at memory location 0x0029eb3c..
Run Code Online (Sandbox Code Playgroud)
在OpenCV 的介绍中,"cv命名空间"一章说明了这一点
某些当前或未来的OpenCV外部名称可能与STL或其他库冲突.在这种情况下,使用显式名称空间说明符来解决名称冲突:
我改变了我的代码并使用了所有显式名称空间说明符,但问题没有解决.如果可以的话,请帮我解决这个问题,或者说找哪个函数和findHomography做同样的事情,不要崩溃程序.
这是我的代码
#include <stdio.h>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
void readme();
/** @function main */
int main( int argc, char** argv )
{
if( …Run Code Online (Sandbox Code Playgroud)