功能.exe:0xc0000005:访问违规读取地点0x0000000000000000

Feature.exe: 0xC0000005: Access violation reading location 0x0000000000000000

本文关键字:读取 0x0000000000000000 exe 0xc0000005 访问 功能      更新时间:2023-10-16

我正在尝试使用DynamicAdaptedFeatureDetector检测和提取图像功能,但是我正在收到访问违规错误。完整的错误是:Unhandled exception at 0x000007FEE08AB89A (opencv_features2d2411d.dll) in Feature.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

我的示例代码是:

.
.
.
    Ptr<FeatureDetector> detector;
    vector<KeyPoint> keypoints1, keypoints2; 
    detector = new DynamicAdaptedFeatureDetector(new FastAdjuster(10, true), 5000, 10000, 10);
    detector->detect(leftImg_roi, keypoints1);
    detector->detect(rightImg_roi, keypoints2);
    Ptr<DescriptorExtractor> extractor;
    extractor = DescriptorExtractor::create("SIFT");
    Mat descriptors1, descriptors2;
    extractor->compute(leftImg_roi, keypoints1, descriptors1);
    extractor->compute(rightImg_roi, keypoints2, descriptors2);
    vector< vector<DMatch> > matches;
    Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create("BruteForce");
    matcher->knnMatch(descriptors1, descriptors2, matches, 500);
.
.
.

错误在行中出现:extractor-> compute(rightimg_roi,kepoints2,distriptors2(;

来自图像的总检测到的关键点为:KePoints1 = 1649和KePoints2 = 1558

我的代码中有什么想法?

您正在获得null pointer exception。当您尝试使用null指针时,系统正在尝试从地址0读取。这是不允许的,因此错误:Access violation reading location 0x0000000000000000

正如您所说的错误时发生在使用变量extractor的线上。我的猜测是extractor是无效的。如果没有,请检查其他变量,然后尝试使用debugger逐步浏览您的代码。您并没有真正提供最小的完整且可验证的例子,所以我无法检查自己。