Search code examples
opencvvisual-studio-2013imread

I cant using imread by path adress opencv 2.4.13 visual studio 2013


hi guys i cant reading image by this code but if i don't use a path address for image and copy image in right folder and use this

img = imread("ali3.jpg");

its worked. i using windows 10 64 bit visual studio 2013 and opencv 2.4.13 thanks for helping

 // بسم الله الرحمن الرحیم
//یا امام هادی علیه السلام
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, char** argv)
{
    Mat img;
    Mat img2;
    int row, column, k;
    img = imread("d:\pic\ali3.jpg");
    namedWindow("Display window", WINDOW_AUTOSIZE);
    imshow("Display window", img);
    cout << "by wmx";
    waitKey(0);
    return 0;
}

Solution

  • Instead of d:\pic\ali3.jpg, use d:\\pic\\ali3.jpg.