I've found several questions relating to this and have tried them. However, I am still unable to resolve the issue. Below are sites that I've used and an explanation of what I've done.
Visual Studieo 2010 with OpenCV 2.3.0
Another Visual Studio 2010 example
What I am using are:
- Windows 7 Professional x64
- Visual Studio 2012 For Windows Desktop
- OpenCV v2.4.10 extracted to D:\Development\OpenCV
Step 1:
I went into Computer > Properties > Advanced system settings > Environment Variables and added:
D:\Development\openCV\build\x64\vc11\bin\
at the end of the Path variable. And then I restarted the computer.
Step 2: Created a new project and edited the Properties for All Configurations.
- Under Configuration Properties > C/C++ > General, I added
D:\Development\openCV\build\include
- Under Configuration Properties > Linker > General, I added
D:\Development\openCV\build\x64\vc11\lib
- Under Configuration Properties > Linker > Input, I added
opencv_calib3d2410d.lib opencv_contrib2410d.lib opencv_core2410d.lib opencv_features2d2410d.lib opencv_flann2410d.lib opencv_gpu2410d.lib opencv_highgui2410d.lib opencv_imgproc2410d.lib opencv_legacy2410d.lib opencv_ml2410d.lib opencv_nonfree2410d.lib opencv_objdetect2410d.lib opencv_photo2410d.lib opencv_stitching2410d.lib opencv_superres2410d.lib opencv_ts2410d.lib opencv_video2410d.lib opencv_videostab2410d.lib
- Under Configuration Properties > Linker > Advanced, I changed the Target Machine to MachineX64.
Step 3: For Build > Configuration Manager, the project is changed to x64 platform.
Step 4: I copied and pasted the code from one of the links above with the path of the image modified and built it.
#include "stdafx.h"
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat im = imread("D:/lena.png");
if (im.empty())
{
cout << "Cannot load image!" << endl;
return -1;
}
imshow("Image", im);
waitKey(0);
}
Step 5: I pressed F7 and the solution built successfully. (Sadly, took a while to just get to this point)
Problem is when I press F5, I would get an error saying "The program can't start because opencv_core2410d.dll is missing from your computer. Try reinstalling the program to fix this problem."
I thought the first step of adding it to the path is the solution. By moving the DLL into the D:\Development\VisualStudio\opencvHelloWorld\x64\Debug folder, I can run the executable. Can anyone shed light on how to fix this problem? What am I missing?
Thank you!