2015年4月30日 星期四

02160571_week10_黃冠瑛


1)複習lesson32
2)下載opencvv2.1安裝opencv2.1
3)新建一個Console Applicalication專案
設定 compile:c:\opencv2.1\include
LinkLib:c:\opencv2.1\lib
Link的參數 cv210 cxcore210 highgui210
4)
#include <opencv/highgui.h>

int main()
{
    IplImage *img= cvLoadImage("earth.jpg");
    cvShowImage("2D",img);
    cvWaitKey(0);
}









5)Linker Setting新增 freeglut opengl32 glu32 gdi32 winmm
6)Compiler 新增C:\Users\USER\Desktop\freeglut-MinGW-3.0.0-1.mp\freeglut\include
Linker新增C:\Users\USER\Desktop\freeglut-MinGW-3.0.0-1.mp\freeglut\lib
7)新增程式碼
#include <opencv/highgui.h>
#include <GL/glut.h>
float angle=0;
void display()
{
    glClear(GL_COLOR_BUFFER_BIT);
    glPushMatrix();
        glRotatef(angle, 0,1,0);
        glutSolidTeapot(0.3);
    glPopMatrix();
    glFlush();
    angle+=0.1;
}

int main(int argc, char ** argv)
{
    IplImage *img= cvLoadImage("earth.jpg");
    cvShowImage("2D",img);
    //cvWaitKey(0);

    glutInit(&argc, argv);
    glutCreateWindow("3D");

    glutDisplayFunc(display);
    glutIdleFunc(display);

    glutMainLoop();
}








小葉老師人超好~程式碼的檔案有給我們可以直接複製貼上(感動QQ)

8)看著老師錄影的youtube寫出地球運轉的程式


沒有留言:

張貼留言