2012-12-11 33 views
0

我正在Xcode中集成C++代碼。我在這條線上遇到問題。Xcode中line imread(「one.jpg」)的問題

src = imread("ellipse.jpg"); 

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

我在資源文件夾中有圖像。但它總是執行if條件。請幫幫我 。提前致謝 。

+0

也許看看http://stackoverflow.com/questions/3396378/change-the-working-directory-in-xcode – gvd

+0

我不明白gvd。我打開了EditSchemes,但沒有任何與工作空間有關 – sri

+0

您沒有看到「選項」選項卡? – gvd

回答

1

看來您的二進制應用程序位於一個文件夾中,而您嘗試加載的映像位於另一個文件夾中。把它們放在同一個文件夾裏!

或...致電imread()時使用圖片的完整路徑。

+0

http://stackoverflow.com/a/12766397/76810 – SSteve