2019年4月11日 星期四

嗶啵啵嗶啵2019/0411_W8

主題:貼圖Texture
開啟範例:Texture.exe
下載: win32.data.glut32.dll

2.在桌面新增window的資料夾&將window.zip解壓縮到資料夾內



3.將data.zip內的data資料夾放到window內



4.將glut32.dll放到window資料夾內



5.開啟Texture.





**************************************************
期中考題:

***************************************************



貼圖~~




2執行exe,有注意事項要注意
          a.選擇Add OpenCV to the system PATH for all users(第二個){資料夾在 C:\OpenCV2.1 }



         b.到https://www.transmissionzero.co.uk/software/freeglut-devel/
             下載 freeglut 3.0.0 MinGW Package

        c.到freeglut -> lib ->新增一個libglut32.a


        c.開啟Codeblocks,建立project(glut),打上茶壺程式碼
#include <GL/glut.h>
void display(){
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glutSolidTeapot(0.3);
    glutSwapBuffers();
    }
    int main(int argc, char**argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
    glutCreateWindow("week08");
    glutDisplayFunc(display);
    glutMainLoop();
}



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("1.jpg");///貼圖需要
    cvShowImage("opencv Window",img);///貼圖需要
    cvWaitKey(0);///貼圖需要

    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
    glutCreateWindow("week08");
    glutDisplayFunc(display);
    glutMainLoop();
}



4.程式碼打完後,加入圖片

        a.點擊右邊資料夾,選擇Bulid option



        b.選 seaarch directiones -> compiler -> Add ->貼上路徑 C:\OpenCV2.1\include



        c.選 seaarch directiones -> Linkde -> Add ->貼上路徑 C:\OpenCV2.1\lib



        d.選Linker setting ->Add -> 貼上cv210、cxcore210、highgui210



5.圖片要放在C:\Users\user\Desktop\freeglut\bin




6.完成!






沒有留言:

張貼留言