0

I followed all the steps given on this page : Installing OpenCV 2.4.3 in Visual C++ 2010 Express

After completing all steps I get this error shown in image.

crash

I am using Visual studio 2010 and Configuring Opencv. I am not getting any dll file missing error. Please guide me through this.

Code is :

#include <opencv2/highgui/highgui.hpp> 
#include <iostream> 

using namespace cv; 
using namespace std; 

int main() 
{ 
    Mat im = imread("c:/full/path/to/lena.jpg"); 
    if (im.empty()) 
    { 
        cout << "Cannot load image!" << endl; 
        return -1; 
    } 
    imshow("Image", im); 
    waitKey(0); 
}
Community
  • 1
  • 1
  • Please can you post the actual code that produces this error? – Roger Rowland May 07 '15 at 04:32
  • @RogerRowland: Thank you for inserting the image. It is the same code that has been posted on that thread at the end. Code is : #include #include using namespace cv; using namespace std; int main() { Mat im = imread("c:/full/path/to/lena.jpg"); if (im.empty()) { cout << "Cannot load image!" << endl; return -1; } imshow("Image", im); waitKey(0); } –  May 07 '15 at 04:59
  • 1
    Two questions: 1) When you click Retry, which source code line above is closest to the top of the call stack? 2) You *do* have an image at the path `c:/full/path/to/lena.jpg` do you? – Roger Rowland May 07 '15 at 06:11
  • @RogerRowland: (1)When I click Retry, it opens a file named "dbgheap.c" and shows an error " Project_name has triggered a breakpoint" (2) And about image path, I gave my own image path. So there is no problem with that, My Image path is "C://Avengers.jpg". I even tried "C:\Avengers.jpg" And "C:/Avengers.jpg". Same error –  May 07 '15 at 21:14
  • You should try "c:\\Avengers.jpg" you need a double backslash in that case, although a single forward slash should have worked. Also, look at the call.stack like I said, and see which line of *your* code is causing the problem. – Roger Rowland May 08 '15 at 02:42
  • @RogerRowland: I tried that path too. It didnt worked. And about call.stack you said, Can you please tell me how can I do it? –  May 09 '15 at 02:16
  • I think you need to investigate the powerful debugging facilities of Visual Studio. MSDN has all the information you need, but for your specific question about how to use the call stack window, [see here for details](https://msdn.microsoft.com/en-us/library/a3694ts5(v=vs.100).aspx). – Roger Rowland May 09 '15 at 05:32

1 Answers1

0
c:/full/path/to/lena.jpg

Is not a valid path! Consider the following example:

I have an image called the avengers on my desktop. Look at the avengers image

To get its path right click on it and got to properties enter image description here Copy the path highlighted "C:\Users\BSathvik\Desktop" and add the name of the file and the type to it. since the name of the image is avengers and type is JPEG. my full path is "C:\Users\BSathvik\Desktop\avengers.JPEG" Now type your full path into imread("C:\Users\BSathvik\Desktop\avengers.JPEG"); Hope this helped :)

Community
  • 1
  • 1
BSathvik
  • 95
  • 1
  • 6
  • I gave my own image path. So there is no problem with that, My Image path is "C://Avengers.jpg". I even tried "C:\Avengers.jpg" And "C:/Avengers.jpg". Same error. And Yes I do have image at that location. Still same error –  May 07 '15 at 21:15