0

I am Integrating the c++ code in the Xcode . I am facing problem at this line.

src = imread("ellipse.jpg");

if(! src.data )                              // Check for invalid input
{
    cout <<  "Could not open or find the image" << std::endl ;
    cv::waitKey(5000);
}

I have the image in resource folder. But it always executes the if condition. Please help me . Thanks in advance .

sri
  • 227
  • 2
  • 12
  • Maybe have a look at http://stackoverflow.com/questions/3396378/change-the-working-directory-in-xcode – gvd Dec 11 '12 at 07:20
  • I didn't understand gvd. I have opened the EditSchemes but there nothing is related to the workspace – sri Dec 11 '12 at 07:31
  • You don't see an "Options" tab? – gvd Dec 11 '12 at 07:59
  • And how is `imread()` defined? How is `src` defined? – trojanfoe Dec 11 '12 at 07:59
  • hi gvd Under the options tab there are somethings called the iphonesimulator display,corelocaion,application data and routing app coverage files are there.which one I have to select? – sri Dec 11 '12 at 08:18

1 Answers1

1

It seems that your binary application is located in one folder, and the image you are trying to load is at another. Place them at the same folder!!!

Or... use the full path to the image when calling imread().

karlphillip
  • 92,053
  • 36
  • 243
  • 426