使用finContours函数和下载ntdll文件时出错

Error in using finContours function and downloading ntdll files

本文关键字:文件 出错 ntdll 下载 finContours 函数 使用      更新时间:2023-10-16

我是使用VS2012的新手&openCV用于完成我的五年规划,我必须使用轮廓检测人体(对象检测)。我已经成功安装了(VS2012 &openCV),一直在做一些基本的图像处理,没有任何未知的问题,除了逻辑或语法,直到我遇到使用findContours函数,我现在被拘留。我的问题是:

当我不使用轮廓相关的东西,即findContours, drawContours,通过评论它,一切都很好,我可以使用跟踪条来扩大/侵蚀图像,但是一旦我使用轮廓相关的东西并按下"F5",图像显示轮廓周围检测到的对象显示与断点一起说Program.exe触发了一个断点,因此我不能进一步使用它。

为方便起见,下面是堆栈跟踪中的清单:

注1:我遵循了pbrandoli给出的说明,但在加载未突出显示的"ntdll.dll &msvcr "通过微软符号服务器被突出显示&在重新启动(ctrl +Shift+F5)或调试(F5)时,它再次得到不突出显示,表明它缺失。

注2:为方便起见,我已对列表进行了简化。

ntdll.dll!77ca5204()    Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] 
    ntdll.dll!77c6fbae()    Unknown
    ntdll.dll!77c02b04()    Unknown
    KernelBase.dll!75ff7e27()   Unknown
>   msvcr110d.dll!_CrtIsValidHeapPointer(const void * pUserData) Line 2036  C++
    msvcr110d.dll!_free_dbg_nolock(void * pUserData, int nBlockUse) Line 1322   C++
    msvcr110d.dll!_free_dbg(void * pUserData, int nBlockUse) Line 1265  C++
    msvcr110d.dll!operator delete(void * pUserData) Line 54 C++
    binaryFrame.exe!std::allocator<cv::Point_<int> >::deallocate(cv::Point_<int> * _Ptr, 
unsigned int __formal) Line 586 C++
    binaryFrame.exe!std::_Wrap_alloc<std::allocator<cv::Point_<int> > 
>::deallocate(cv::Point_<int> * _Ptr, unsigned int _Count) Line 888 C++
    binaryFrame.exe!std::vector<cv::Point_<int>,std::allocator<cv::Point_<int> > >::_Tidy() 
    binaryFrame.exe!showBinImage() Line 66  C++
    binaryFrame.exe!main(int __formal, char * * argv) Line 21   C++
    binaryFrame.exe!__tmainCRTStartup() Line 536    C
    binaryFrame.exe!mainCRTStartup() Line 377   C
    kernel32.dll!763e1154() Unknown
    ntdll.dll!77c3b299()    Unknown
    ntdll.dll!77c3b26c()    Unknown

下面是我在图像中用于轮廓检测的代码:

#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
void showBinImage();
int val=2;

int main( int, char** argv )
{
    showBinImage();
    return 0;
}  

void showBinImage(){
Mat bin;
Mat im_gray;   

Mat im_rgb  = imread("nk5.jpg");
        //  Trackbar
namedWindow("ErodedImage",1);
createTrackbar("Erode", "ErodedImage", &val, 50);
cvtColor(im_rgb, im_gray,CV_RGB2GRAY);
threshold(im_gray, bin, 128.0, 255.0, THRESH_BINARY_INV);
//imwrite("bnasir.jpg", img_bw);
namedWindow("Binary",1);
imshow("Binary", bin);
while (true)
{
Mat erodeElement = getStructuringElement( MORPH_CROSS,Size(val*3,val*3));   
Mat dilateElement = getStructuringElement( MORPH_RECT,Size(val*8,val*8));
Mat eroded; // the destination image
erode(bin,eroded,erodeElement+50);
dilate(eroded,eroded,dilateElement);    
std::vector<std::vector<cv::Point>> contours;       
findContours(eroded, contours, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE);  
// Draw black contours on a white image
Mat result(eroded.size(),CV_8U,cv::Scalar(255));
drawContours(result,contours,-1, cv::Scalar(0), 2); // with a thickness of 2
imshow("ErodedImage",(eroded));
waitKey(10);
}

}

我从VS2012切换到VS2010,现在一切都很好!我不知道VS2012的问题是什么,因为VS2013也提供了VS2010的结果,但要使用VS2013,你需要Windows 8操作系统。因此我回到了旧版本,因为我使用的是Windows 7操作系统!