2022年4月19日 星期二

鹿的電腦圖學筆記week09

 Step1:

1.下載data.zip,windows.zip(解壓)

2.data移到windows(file)

3.打開Texture.exe



Step2:
1.下載opencv 2.1.0 win32 vx2008
2.注意 ADD PATH(第二個),目錄不能改
3.加入
#include<opencv/highgui.h>

int main(){
    IplImage *img=cvLoadImage("檔名.jpg");
    cvShowImage("week09",img);
    cvWaitKey(0);
}
4.更改設定
Settings->Compiler
在Search directions->Compiler加入C:\OpenCV2.1\Include
再到Search directions->Linker加入C:\OpenCV2.1\lib
5.到LinkerSettins加入cv210,cxcore210,highgui210
6.執行跑出圖片



Step3:
1.寫入
#include <GL/glut.h>
#include <opencv/highgui.h>
void myTexture(){
    IplImage * img = cvLoadImage("earth.png"); //讀圖
cvShowImage( "week09_2", img ); //秀圖
}
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("week09_texture");

    glutDisplayFunc();
    myTexture();
    glutMainLoop();
}
2.執行結果



沒有留言:

張貼留言

VERY BEAUTIFUL, VERY POWERFUL

一.     一樣先安裝且設定好freeglut,OpecCV, 開啟CodeBlocks建立新專案 week11_gundam,                 把 MyGundam.zip下載解壓縮後的data資料夾放到freeglut/bin裡面 把week09_openc...