Computer vision 快速等高线图

Computer vision 快速等高线图,computer-vision,Computer Vision,我已经实现了使用fastcv查找和绘制最大轮廓的代码。但我没有得到实际产出。找到最大轮廓是好的。但绘制最大轮廓并不能给出结果。请提出任何建议 unsigned int maxNumContours = 1000; unsigned int size = 0; unsigned int sizeOfPointBuffer = 0; unsigned int maxPoints= ((2*ImgWidth) + (2 * ImgHeight)); //Ac

我已经实现了使用fastcv查找和绘制最大轮廓的代码。但我没有得到实际产出。找到最大轮廓是好的。但绘制最大轮廓并不能给出结果。请提出任何建议

    unsigned int maxNumContours = 1000;
    unsigned int size  = 0;
    unsigned int sizeOfPointBuffer = 0;
    unsigned int maxPoints= ((2*ImgWidth) + (2 * ImgHeight));

    //Actual Found Contour
    unsigned int pNumContours = 0;

    //Total Number of Points in Each Contour
    unsigned int pNumContourPoints[1000] = {0};

    //Pointer to Start of All Contour
    unsigned int *pContourStartPointsfind[1000];

    size = (maxPoints * sizeof(unsigned int));

    sizeOfPointBuffer = (1000 * 2 * maxPoints * sizeof(unsigned int));
    unsigned int *pPointBuffer=(unsigned int *)malloc(sizeOfPointBuffer);
    memset(pPointBuffer,0,sizeOfPointBuffer);

    int32_t hierarchy[1000][4];

    fcvFindContoursExternalu8(mGr.data,ImgWidth,ImgHeight,ImgWidth,maxNumContours,&pNumContours,pNumContourPoints,pContourStartPointsfind,pPointBuffer,sizeOfPointBuffer,hierarchy,fcvFindContoursAllocate(ImgWidth));

    __android_log_print(ANDROID_LOG_INFO, "JNI PART", "pNumContours = %d \n",pNumContours);

    /*for(int j = 0; j < 5; j++){
        __android_log_print(ANDROID_LOG_INFO, "JNI PART", "Number of Points in [%d] = %u \n",j, pNumContourPoints[j]);
    }*/

    int maxContour = pNumContourPoints[0];

    int maxIndex = 0;

    for(int j = 1; j < pNumContours; j++){
        if(pNumContourPoints[j] > maxContour){
            maxContour = pNumContourPoints[j];
            maxIndex = j;
        }
    }

    /*unsigned int *pContourStartPointsdraw[1000];
    for(int i = 0; i < pNumContours; i++){
        pContourStartPointsdraw[i] = pContourStartPointsfind[i];
    }*/



    unsigned int holeflag1[1] = {0};

    unsigned int maxDraw[1] = {0};
    maxDraw[0] = pNumContourPoints[maxIndex];

    unsigned int *pContourStartPointsdraw[1] = {0};
    pContourStartPointsdraw[0] = pContourStartPointsfind[maxIndex];

    unsigned int pointDrawBufferSize = (pNumContourPoints[maxIndex]);

    __android_log_print(ANDROID_LOG_INFO, "JNI PART", "pNumContourPoints[maxIndex] :: %d\n",pNumContourPoints[maxIndex]);



    unsigned int *dummyPointer = pPointBuffer;

    dummyPointer = pContourStartPointsfind[maxIndex];

    unsigned int *pointBufferForDraw = (unsigned int *)malloc(pointDrawBufferSize);

    memset(pointBufferForDraw, 0, pointDrawBufferSize);

    memcpy(pointBufferForDraw, dummyPointer, pointDrawBufferSize);

    /*for(int k = 0; k < pNumContourPoints[maxIndex]; k++) {
        __android_log_print(ANDROID_LOG_INFO, "JNI PART", "Value of K:: %d\t",k);
        __android_log_print(ANDROID_LOG_INFO, "JNI PART", "Value at PointBuffer:: %d\n",pointBufferForDraw[k]);
    }*/

    fcvDrawContouru8(mContourImg.data,ImgWidth,ImgHeight,ImgWidth,1,holeflag1,maxDraw,(const unsigned int **)pContourStartPointsdraw,pointDrawBufferSize,pointBufferForDraw,&hierarchy[maxIndex],0,2,125,125);
unsigned int maxNumContours=1000;
无符号整数大小=0;
无符号int-sizeOfPointBuffer=0;
无符号整数最大点=((2*ImgWidth)+(2*ImgHeight));
//实际发现的轮廓
无符号整型pNumContours=0;
//每个等高线中的总点数
无符号整数点[1000]={0};
//指向所有轮廓起点的指针
无符号int*pContourStartPointsfind[1000];
大小=(maxPoints*sizeof(unsigned int));
sizeOfPointBuffer=(1000*2*maxPoints*sizeof(unsigned int));
unsigned int*pPointBuffer=(unsigned int*)malloc(sizeOfPointBuffer);
memset(pPointBuffer,0,sizeOfPointBuffer);
int32_t层次结构[1000][4];
fcvFindContoursExternalu8(管理数据、ImgWidth、ImgHeight、ImgWidth、maxNumOnTours和pNumContours、pnumContoursPoints、pcOnToursStartPointsFind、pPointBuffer、SizeOffPointBuffer、层次结构、FCVFindContoursLocate(ImgWidth));
__android_日志_打印(android_日志_信息,“JNI部分”,“pNumContours=%d\n”,pNumContours);
/*对于(int j=0;j<5;j++){
__android_log_print(android_log_INFO,“JNI部件”,“[%d]中的点数=%u\n”,j,pNumContourPoints[j]);
}*/
int maxContour=pNumContourPoints[0];
int maxIndex=0;
对于(int j=1;jMaxContourt){
maxContour=pNumContourPoints[j];
maxIndex=j;
}
}
/*无符号整数*pContourStartPointsdraw[1000];
对于(int i=0;i