1.秀一張地球的圖片
#include <opencv/highgui.h>
int main()
{
IplImage * img =cvLoadImage("image.jpg");
cvShowImage("02160845_2D",img);
cvWaitKey(0);
}
步驟
環境的設定
路徑位置 C:\OpenCV2.1\include
路徑位置 C:\OpenCV2.1\lib
加上 cv210
cxcore210
highgui210
將圖檔&3個dll黨 丟進此資料夾中
2.同時秀2d地球的圖片和3d會旋轉的茶壺
#include <GL/glut.h>
#include <opencv/highgui.h>
float angle=0;
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glRotatef(angle,0,1,0);
glutSolidTeapot(0.3);
glPopMatrix();
glFlush();
angle+=0.1;
}
int main(int argc,char**argv)
{
IplImage * img =cvLoadImage("image.jpg");
cvShowImage("02160845_2D",img);
//cvWaitKey(0);
glutInit(&argc,argv);
glutCreateWindow("3D");
glutDisplayFunc(display);
glutIdleFunc(display);
glutMainLoop();
}
步驟
(1)仿照上述步驟 建置freeglut的環境
(2)將freeglut.dll丟到cpp的資料夾中
沒有留言:
張貼留言