1.點選四色圖然後按右鍵-->點選Bulid option
2.在Search directories的Compiler中丟入-->C:/OpenCV2.1\include
3.在Search directories的Linker中丟入-->C:\OpenCV2.1\lib
4.在Linker settings中加入(一.cv210 二.cxcore210 三.highgui210)
5.要把圖片加到Week08_opencv
6.程式碼如下
#include <opencv/highgui.h>
int main()
{
IplImage * img=cvLoadImage("image.jpg");
cvShowImage("opencv Window", img);
cvWaitKey(0);
}
如何下載opencv:
要載OpenCV-2.1.0-win32-vs2008.exe才對
第二段程式碼
另外要載win32和glut和lib
#include <GL/glut.h>
#include <opency/highgui.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
int main(int arc, char**argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE |GLUT_DEPTH);
glutCreateWindow("Week08 texture");
glutDisplayFunc(display);
glutMainLoop();
沒有留言:
張貼留言