正文
opencv 3.2 vs2015 debug assertion __acrt_first_block == header
小程序:扫一扫查出行
【扫一扫了解最新限行尾号】
复制小程序
【扫一扫了解最新限行尾号】
复制小程序
网上复制了一个转直方图的代码 ,说来也奇怪, 用imshow 显示 图片在独立窗体内,不存在问题, 要注释掉这段代码就出现了下边的错误. 网上查了查,原来是程序中 有个std::vector<cv::Mat> ColorChannels;写法出了问题
//char OUTPUT_T[] = "histogram demo";
//imshow(OUTPUT_T, histImage);
报错:
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!Program: ...workspace\FileConverter\FileHandler\x64\Debug\FileHandler.exe
File: minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp
Line: Expression: __acrt_first_block == headerFor information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.(Press Retry to debug the application)---------------------------
中止(A) 重试(R) 忽略(I)
---------------------------
问题原因有人说:使用DLL的时候,问题可能在于不同的堆用于分配和释放 引起的。
网上找到一段英文按照他说的改了,没问题了
The following code does not give the assertion, I simply changed std::vector<cv::Mat> ColorChannels; to cv::Mat ColorChannels[];.I think that my solution is quick and dirty and maybe the solution offered by iedoc is better (I did not test it).
把上边的
std::vector<cv::Mat> ColorChannels;换成 cv::Mat ColorChannels[3];.
问题解决