0

Labwindows\CVI で National Instruments Vision モジュールを使用しています

何らかの理由で、 func を使用するとimaqDetectLines()FATAL RUN-TIME ERROR: "Angle tracker.c", line 50, col 11, thread id 0x00002004: The program has caused a 'General Protection' fault at 0x6C5AD446.

これは私のコードです:

#include "nivision.h"
#include <userint.h>
#include <cvirte.h>

int main (int argc, char *argv[])
{
    int nLines;
    ShapeDetectionOptions stShapeDetectionOption;
    RangeFloat aAngleRanges[2]={{0,10.0},{10.0,20.0}};
    CurveOptions stCurveOptions = {0};
    LineMatch *aLm;
    LineDescriptor lineDesc;
    Image *imageHdl = NULL, *imageDestHdl = NULL;
    char temp[1024] ="";

    if (InitCVIRTE (0, argv, 0) == 0)
        return -1;    /* out of memory */

    imageHdl = imaqCreateImage (0/*U8*/,1); 
    imageDestHdl = imaqCreateImage (0/*U8*/,1); 

    strcpy(temp,"C:\\CVI2013\\Projects\\Angel Tracker\\IMG\\CC01.bmp");

    imaqReadFile (imageHdl, temp, NULL, NULL);

    imaqEdgeFilter (imageDestHdl, imageHdl, IMAQ_EDGE_SOBEL, NULL);

    lineDesc.maxLength = 100;
    lineDesc.minLength = 50;

    stShapeDetectionOption.minMatchScore = 1;
    stShapeDetectionOption.mode = 0;
    stShapeDetectionOption.numAngleRanges = 1;
    stShapeDetectionOption.angleRanges = aAngleRanges;
    stShapeDetectionOption.scaleRange.minValue = 1;
    stShapeDetectionOption.scaleRange.maxValue = 10;

    stCurveOptions.extractionMode = 0;
    stCurveOptions.threshold = 100;
    stCurveOptions.filterSize = 1;
    stCurveOptions.minLength = 100;
    stCurveOptions.rowStepSize = 10;
    stCurveOptions.columnStepSize = 10;
    stCurveOptions.maxEndPointGap = 1000;
    stCurveOptions.onlyClosed = TRUE;
    stCurveOptions.subpixelAccuracy = TRUE;

    aLm = imaqDetectLines(imageDestHdl, &lineDesc, &stCurveOptions
                           ,&stShapeDetectionOption, NULL, &nLines);

    return 0;
}

私が実際にやっていることは次のとおりです。

  1. BMP ファイルを開く

  2. SOBELimaqEdgeFilter()を使用してfuncでエッジフィリング

  3. imaqDetectLines()次に、関数で行を検出したい

4

1 に答える 1

1

問題が見つかりました。

関数呼び出しを見ると:

aLm = imaqDetectLines(imageDestHdl, &lineDesc, &stCurveOptions
                       ,&stShapeDetectionOption, NULL, &nLines);   

ROI パラメーターについては、関数パネルのヘルプから取得したため、NULL を渡しました。

円を検出できる場所を指定する、画像に適用される関心領域。イメージ全体を検索するには、このパラメーターを NULL に設定します。

しかし、どうやらこれは既知のバグであり、修正される予定であるため、これを回避するには、次の手順を実行してください。

ROI *roi;    
imaqSetWindowROI (0, NULL);    
roi = imaqGetWindowROI (0);  

そして、それを関数に送信します。

aLm = imaqDetectLines(imageDestHdl, &lineDesc, &stCurveOptions
                       ,&stShapeDetectionOption, roi, &nLines);  
于 2016-11-25T05:59:20.180 に答える