构建 Delaunay 三角剖分示例 OpenCV C++ 时出错

error building Delaunay triangulation example OpenCV C++

我正在尝试 运行 Delaunay 示例代码 https://github.com/Itseez/opencv/blob/master/samples/cpp/delaunay2.cpp。但是我在构建时遇到了这个错误:"identifier "LINE_AA" is undefined", and "identifier "LINE_8" is undefined"。您认为问题出在哪里?

我使用 cmake 构建了项目,它在 cmakelist.txt:

cmake_minimum_required(VERSION 2.8)
project( delaunay2)
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( delaunay2 delaunay2.cpp )
target_link_libraries( delaunay2 ${OpenCV_LIBS} )

我也在 winodws 7x64 下 运行ning MSVC 2012。

这是一张调试断言错误的图片,即使在我忽略之后它仍然弹出,但它为我画了一些线!

由于您使用的是 opencv2.4.x,请尝试 2​​.4 示例:https://github.com/Itseez/opencv/blob/2.4/samples/cpp/delaunay2.cpp

2.4.x 和 3.0 差别很大。

终于成功了。这是使用 OpenCV 2.4.9 进行 delaunay 三角剖分的正确 link:

https://github.com/Itseez/opencv_attic/blob/master/opencv/samples/c/delaunay.c