"pin.png"を読み込みたい
該当のソースコード
C++
1#include "pch.h" 2#include <iostream> 3#include<opencv2/opencv.hpp> 4#pragma comment(lib, "opencv_world400d.lib") 5using namespace std; 6using namespace cv; 7 8 9int main() 10{ 11 Mat img; 12 img = imread("pin.png"); 13 if (img.empty()) { 14 15 cout << "Unable to read the file"; 16 cin.get(); 17 return -1; 18 } 19 imshow("Image", img); 20 waitKey(); 21 return 0; 22}
試したこと
デバックしたが読み込めない"Unable to read the file"
if文をなくした場合, imshowの所でハンドルされていない例外とエラー表示されます.よくわかりません。
絶対パスの場合は表示されます。
補足情報(FW/ツールのバージョンなど)
Visual Studio2017
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/03/02 10:01
2019/03/02 10:03
2019/03/02 10:07
2019/03/02 10:09 編集
2019/03/02 10:14