I'm having some difficulties trying to use OpenCV with visual studio 2008 (Professional Edition). I believe I've done everything necessary to run a OpenCV sample, but it crashes due to a run-time error. This is driving me insane, I hope someone can help.
But first things first.
Downloaded OpenCV 2.4.5 from sourcefourge.net.
When prompted, I chose "Z:\Games instalados\OpenCV" as my "Extract to" option in the .exe downloaded from the above link.
Went to "Control Panel" -> "System" -> "Advanced System Settings", then clicked on the "Environment Variables" in the "Advanced" tab. In the "System Variables" box I highlighted "Path" and clicked on "Edit...". In the new window I added to the end of the text in "Variable Value" my installation directory with a ";" before it, namely ";Z:\Games instalados\OpenCV\opencv\build\x86\vc11\bin" (without the double quotes). Here's a screenshot: .
I've also tried with the hough lines sample, but it didn't worked as well (even with the image in the same folder as the .exe imread() wouldn't find the image).
Any help would be greatly appreciated.
If I've not made some of the installation steps clear enough, please post a comment.
I've detailed a full installation procedure (from scratch) for the latest release of OpenCV to be used with Visual Studio 2008. If anyone solves this question we will have a complete, working tutorial for anyone having the same necessity (use latest OpenCV with visual studio 2008), and possibly (because of the depth in the installation procedure) a general guide for installing the latest OpenCV with most Visual Studio versions (not just the 2008, since the tutorial wouldn't change much, and the reader could easily adapt it).
I would suggest if you want to test proper installation of opencv. Just load a simple.jpg image in opencv and display it. If this works then you can start debugging the program which is crashing. You can debug it by successively enabling the cout. May be first just enable the default cout in example cout_mat.cpp and comment rest of it.
Here is the simple load program you can try to test your installation.
int main(int argc, char*argv[])
{
cvNamedWindow("My_Win", CV_WINDOW_AUTOSIZE);
IplImage *img = cvLoadImage("C:\\vid_an2\\Desert.jpg", CV_LOAD_IMAGE_UNCHANGED );
std::cout<<"Info About Image"<<std::endl;
std::cout<<"Size of Image "<<img->nSize<<std::endl;
std::cout<<"Image channels "<<img->nChannels<<std::endl;
std::cout<<"Image Width "<<img->width<<std::endl;
std::cout<<"Image Height "<<img->height<<std::endl;
std::cout<<"Image Depth "<<img->depth<<std::endl;
std::cout<<"Image WidhtStep "<<img->widthStep<<std::endl;
std::cout<<"Image Size "<<img->imageSize<<std::endl;
cvShowImage("My_Win", img);
cvWaitKey(0);
// Free the resources.
cvDestroyAllWindows();
cvReleaseImage(&img);
return 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With