使用数组跟踪机器人图像的正确方法是什么?

时间:2019-04-05 03:22:31

标签: arrays image-processing graphics clion

我要解决的问题是找出设置方法,以使用数组和设置的图形来跟踪此“机器人”的图像。我将如何追踪它而不是精确的图像,而是寻找可能与图像相似的位置?

更新:所以我尝试放入下面的代码,由于这个问题,它现在无法运行。

“ C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/bin /../ lib / gcc / x86_64-w64-mingw32 / 7.2.0 /../../。 ./../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e):对'WinMain'的未定义引用 collect2.exe:错误:ld返回1退出状态 mingw32-make.exe [3]: * [CMakeFiles \ demo.dir \ build.make:102:demo.exe]错误1 mingw32-make.exe [2]: [CMakeFiles \ Makefile2:72:CMakeFiles / demo.dir / all]错误2 mingw32-make.exe 1 [CMakeFiles \ Makefile2:84:CMakeFiles / demo.dir / rule]错误2 mingw32-make.exe:* [Makefile:117:演示]错误2“

Image

int data[12] = {
    0, 50, 50, 25,
    1, 200, 125, 100, 275, 200, 375,
    9
};

尝试

void drawScene(void) {

    int index = 0;
    int shape_type;
    int done = 0;

    clearWindow();
    setColor(YELLOW);
    index = 0;
    for(int i=0; i<2;i++) {
        shape_type = data[index];     // this should be the shape code
        index = index + 1;      // now index point to the first parameter
        switch(shape_type) {
            case 0: // circle
                drawFilledCircle(
                   data[index], data[index+1], data[index+2]);
                index = index + 3;
                break;
            case 1: // triangle
                drawFilledTriangle(
                    data[index], data[index+1], 
                    data[index+2], data[index+3], 
                    data[index+4], data[index+5]);
                index = index + 6;
                break;
            default: // done with shape loop
                done = 1;
        }
        if (done == 1) break;
    }
    glEnd();
    glFlush();
    glutSwapBuffers();
    glEnd();
}

0 个答案:

没有答案