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.執行結果



沒有留言:
張貼留言