Hi all, I am having problem with openCV:
I am using Microsoft Studio 2008
From this lnk: http://sourceforge.net/projects/opencvlibrary/ I downloaded the OpenCV_1.1pre1a.exe for windows and installed it.
I have been searching ways to include the libraries installed but the instructions don't seem to match my VS version?
So after creating a new project I went to the folder where the .cpp and .h files were and started adding the .h files that were installed.
(cv.h ,cxcore.v and so on)
The code was compiling but when I added the highgui.h I got this error:
Error 1 error LNK2019: unresolved external symbol _cvReleaseImage referenced in function _main HelloWorld.obj MyOpenCV
Error 2 error LNK2019: unresolved external symbol _cvWaitKey referenced in function _main HelloWorld.obj MyOpenCV
Error 3 error LNK2019: unresolved external symbol _cvShowImage referenced in function _main HelloWorld.obj MyOpenCV
Error 4 error LNK2019: unresolved external symbol _cvMoveWindow referenced in function _main HelloWorld.obj MyOpenCV
Error 5 error LNK2019: unresolved external symbol _cvNamedWindow referenced in function _main HelloWorld.obj MyOpenCV
Error 6 error LNK2019: unresolved external symbol _cvLoadImage referenced in function _main HelloWorld.obj MyOpenCV
Error 7 fatal error LNK1120: 6 unresolved externals C:\Users\USER\Documents\Visual Studio 2008\Projects\MyOpenCV\Debug\MyOpenCV.exe MyOpenCV
The code was taken from an example on the internet:
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "cv.h"
#include "highgui.h"
int main(int argc, char *argv[])
{
IplImage* img = 0;
int height,width,step,channels;
uchar *data;
int i,j,k;
if(argc<2){
printf("Usage: main <image-file-name>\n\7");
exit(0);
}
// load an image
img=cvLoadImage(argv[1]);
if(!img){
printf("Could not load image file: %s\n",argv[1]);
exit(0);
}
// get the image data
height = img->height;
width = img->width;
step = img->widthStep;
channels = img->nChannels;
data = (uchar *)img->imageData;
printf("Processing a %dx%d image with %d channels\n",height,width,channels);
// create a window
cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE);
cvMoveWindow("mainWin", 100, 100);
// invert the image
for(i=0;i<height;i++) for(j=0;j<width;j++) for(k=0;k<channels;k++)
data[i*step+j*channels+k]=255-data[i*step+j*channels+k];
// show the image
cvShowImage("mainWin", img );
// wait for a key
cvWaitKey(0);
// release the image
cvReleaseImage(&img );
return 0;
}
All I want, is to get the OpenCV to work so I can finally start doing my project.
Any help will be appreciated.
By the way, I was trying to get this thing to work all day yesterday but with no success.