OpenCV findContours 导致调试断言在返回时失败
OpenCV findContours causes Debug Assertion Failed at return
我正在使用OpenCV v 2.4.8在Visual Studio 2013上编程。这是我的代码
#define _CRT_SECURE_NO_WARNINGS
#include <cv.h>
#include <highgui.h>
int main(int argc, char* argv[])
{
cv::Mat image = cv::imread(argv[1], 0);
image = image > 100;
std::vector<std::vector<cv::Point> > contours;
cv::findContours(image, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
return 0;
}
在发布模式下一切都正常,我不明白为什么它在调试模式下不能正常工作。它会导致调试断言在return 0;
失败
(表达式 : _pFirstBlock == pHead)。
我想轮廓有问题。
非常感谢您的帮助。
在"
属性"下> C++>"运行时">代码生成:
如果 MSVC 运行时库设置为多线程调试 DLL (/MDd),则这没有问题(它工作正常)。
如果 MSVC 运行时库设置为多线程调试 (/MTd),则它将引发此错误,可以通过以下说明修复此错误。
相关文章:
- 函数返回时,带指针的复制构造函数失败
- 当命令失败时,gzip 会在 C++ 中返回错误代码吗?
- 测试用例状态为失败,但返回的值为 true
- 返回 std::stringstream - 编译失败
- VirtualAllocEx 失败 GetError 返回ERROR_INVALID_ADDRESS
- 在 Linux 上,JNI AttachNativeThread 总是失败,返回值为 -1
- 从返回绑定中获取函数失败
- GMock 的"WillOnce"和"Return"不会因错误的返回值而失败
- 失败RSA_Verify将返回错误的签名错误
- 函数应该返回可能会失败的功能
- 使用Outlook 2016:MAPISendMail在Windows应用程序中失败,并返回"MAPI_E_FAILURE"作为错误代码
- 返回 std::p air<const CustomClass &, bool> 用于搜索函数中的失败情况,当 CustomClass 是抽象基类时
- 为什么返回的 FILE* 在 popen() 中的命令失败时保留数据
- C++重写 void 函数返回类型会导致生成失败
- 查找函数在失败结果中应该返回什么
- 超能力 NDK 安卓:返回 int 在"extern"块中成功,在调用函数中失败
- std :: malloc在失败时返回null或nullptr吗?
- MYSQL总是返回失败
- 一旦 cudaMalloc 返回内存不足,每个 cuda API 调用都会返回失败
- 返回失败的输出