貼圖
1.
2.
3.
4.
5.
6.
7.CodeBlocks重開
8.
9.
10.
11.
12.
13.
14.
15.
16.
#include<opencv/highgui.h>///用OpenCV的HIGH GUI介面
///要把 include 目錄 C:\OpenCV2.1\include 設定好
int main()
{
IplImage * img=cvLoadImage("earth.jpg");///讀圖
///有undefine的函式,要 link lib檔
///C:\OpenCV2.1\lib 有cv210.lib cxcore210.lib highgui210.lib
cvShowImage("opencv Window", img);///秀圖
cvWaitKey(0);///等你 按鍵
}
背景貼圖earth有茶壺
1.
2.
3.
4.
#include<GL/glut.h>
#include<opencv/highgui.h>///貼圖
///要把 include 目錄 C:\OpenCV2.1\include 設定好
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");///貼圖
///有undefine的函式,要 link lib檔
///C:\OpenCV2.1\lib 有cv210.lib cxcore210.lib highgui210.lib
cvShowImage("another window", img);///貼圖
cvWaitKey(0);///貼圖
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("week08_texture");
glutDisplayFunc(display);
glutMainLoop();
}
沒有留言:
張貼留言