2019年4月11日 星期四

Week 08 貼圖

1.開啟http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/

2.Examples下載win32、data

3.other examples下載glut32.dll

4.解壓縮windows資料夾

5.將data壓縮檔打開(不要解壓縮),直接拖曳到windows資料夾中

6.將glut32.dll放入windows資料夾中

7.打開Texture.exe即可使用


使用OpenCV程式

1.Google:OpenCV 2.1找到第一個裡面OpenCV-2.1.0-win32-vs2008.exe下載安裝

(1)要C:\OpenCV2.1目錄
(2)要選中間Add Path
(3)裝好後才能啟動CodeBlocks

2.安裝freeglut

3.複製程式碼:
#include <GL/glut.h>

#include <opencv/highgui.h>///貼圖需要
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glutSolidTeapot( 0.3 );
    glutSwapBuffers();
}
int main(int argc, char**argv)
{
    IplImage * img=cvLoadImage("earth.jpg");///貼圖需要
    cvShowImage("opencv Window", img);///貼圖需要
    cvWaitKey(0);///貼圖需要

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE |GLUT_DEPTH);
    glutCreateWindow("Week08");

    glutDisplayFunc(display);

    glutMainLoop();
}

4.設定程式:

(1)右邊workspace專案名稱右鍵選build options

(2)分頁選Search directories中的Compiler,Add OpenCV程式所在位置(C:\OpenCV2.1\include)

(3)小分頁選Linker,Add(C:\OpenCV2.1\lib)

(4) 大分頁Linker Setting,Add:(cv210)(cxcore210)(highgui210)


5.earth.jpg圖檔要放到freeglut的bin中即可完成。



沒有留言:

張貼留言