STEP1:http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/進入
開啟texture.exe
Download:OpenCV-2.1.0-win32-vs2008.exe
STEP3:開CodeBlocks開新專案
程式碼:
#include <opencv/highgui.h> /// 使用 OpenCV 的 HIGH GUI 介面
int main()
{
IplImage * img = cvLoadImage("earth.jpg"); ///讀圖檔
cvShowImage("opencv Window_0616045_test", img); ///秀出圖
cvWaitKey(0); ///等按按鍵停止
}
int main()
{
IplImage * img = cvLoadImage("earth.jpg"); ///讀圖檔
cvShowImage("opencv Window_0616045_test", img); ///秀出圖
cvWaitKey(0); ///等按按鍵停止
}
STEP4:開CodeBlocks開GLUT專案
程式碼:
#include <GL/glut.h>
#include <opencv/highgui.h> ///texture貼圖
static void display()0
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
int main(int argc, char *argv[])
{
IplImage * img = cvLoadImage("earth.jpg"); ///texture貼圖
cvShowImage("opencv Window_06160645_test", img); ///texture貼圖
cvWaitKey(0); ///texture貼圖
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("06160504_week07_texture");
glutDisplayFunc(display);
glutMainLoop();
}
#include <opencv/highgui.h> ///texture貼圖
static void display()0
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
int main(int argc, char *argv[])
{
IplImage * img = cvLoadImage("earth.jpg"); ///texture貼圖
cvShowImage("opencv Window_06160645_test", img); ///texture貼圖
cvWaitKey(0); ///texture貼圖
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("06160504_week07_texture");
glutDisplayFunc(display);
glutMainLoop();
}
沒有留言:
張貼留言