2019年4月11日 星期四

朱書樑的上課筆記w8

一.主題:貼圖Texture
1.到http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/下載[data][win32][glut32.dll]
2.將[win32]解壓縮,並將data以及glut32.dll放入資料夾中
3.打開Texture.exe並進行操作即可
二.實作:OpenCV
2.進行安裝程序
注意:出現"是否要加入捷徑"選項時,一定要選第二或第三個

3.下載完成後,打開codeblocks並打開新的Glut project並打入以下程式碼:

程式碼:
#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("06160540");
    glutDisplayFunc(display);
    glutMainLoop();
}

4.將一張圖(jpg檔)放入freeglut的檔案bin中
5.進入codeblock,到左邊的目錄中打開設定介面

6.將OpenCV2.1(下載完成後在c槽中)裡面的include檔案打開,並將上面的位置複製到Search directories的compiler中
7.將OpenCV2.1(下載完成後在c槽中)裡面的lib檔案打開,並將上面的位置複製到Search directories的linker中
8..將OpenCV2.1(下載完成後在c槽中)裡面的lib檔案打開,並將裡面的cv210,cxcore210,highgui210添加到Link settings中
9.設定完畢後,即可執行




沒有留言:

張貼留言