Examples: [data]、[win32]、glut32.dll>將[win32]解壓縮> 把[data]、glut32.dll、放進[win32]資料夾 > 打開範例Texture.exe
<安裝opencv 2.1>
opencv2.1下載網址:
https://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.1/
1.下載Opencv2.1.0-windows32-vs2008.exe>安裝選項選擇 Add OpenCV to the systeam PATH for all users
2.打開codeblocks>file>new>project>glut project
<期中考10行程式>
glPushMatrix();///備份矩陣
glRotatef(angle,x,y,z);///旋轉
glTranslated(x,y,z);///移動
glScalef(x,y,z);///縮放
glBegin(GL_POLYGON);///開始畫
glColor3f(r,g,b);///顏色,色彩
glTexCoord2f(tx,ty);///貼圖座標
glNormal3f(nx,ny,nz);///打光的法向量
glVertex3f(x,y,z);///頂點
glEnd();
glPopMatrix();///備份矩陣
<印出圖檔>
#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("a.jpg");
cvShowImage("opencv Window", img);
cvWaitKey(0);
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow("week08");
glutDisplayFunc(display);
glutMainLoop();
}
在Project選擇Build options
在search directions>complier新增C:\OpenCV2.1\include
在search directions>linker新增C:\OpenCV2.1\lib
在Linker Settings>新增cv210/cxcore210/highgui210
最後執行
沒有留言:
張貼留言