[問題] 影像載入出錯 [已解決]
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Visual Studio 2010 C++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
OpenCV
問題(Question):
imread讀入影像路徑後,卻發現是空的
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
#include <cv.h>
#include <highgui.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/opencv.hpp>
#include "iostream"
#include <vector>
#include <fstream>
using namespace cv;
using namespace std;
void getDir(const char* d, vector<string> & f)
{
FILE* pipe = NULL;
string pCmd = "dir /b /s " + string(d);
char buf[256];
if( NULL == (pipe = _popen(pCmd.c_str(),"rt")))
{
cout<<"Shit"<<endl;
return;
}
while (!feof(pipe))
{
if(fgets(buf,256,pipe) != NULL)
{
f.push_back(string(buf));
}
}
_pclose(pipe);
}
int main(int argc, char* argv[])
{
vector<string> files;
getDir("Z:\\Bryant\\試片受潮測試\\20150414\\10\\2nd\\myfilename000.tiff",
files);
string str=files[0];
Mat original_image;
original_image=imread(str);
system("pause");
return 0;
}
補充說明(Supplement):
build up是成功的
可是,設中斷點於original_image時候
於區域變數看到dims竟然是0
data那裡出現 錯誤Ptr (無法評估運算式)
請問各位高手,是哪裡出問題?
這問題困擾我3天了,尋遍各種方法皆無效
謝謝大家幫忙
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.220.69.195
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1429528577.A.F59.html
※ 編輯: LCY1983 (175.182.140.93), 04/20/2015 21:40:08
→
04/20 22:01, , 1F
04/20 22:01, 1F
→
04/20 22:07, , 2F
04/20 22:07, 2F
→
04/20 22:08, , 3F
04/20 22:08, 3F
→
04/20 22:09, , 4F
04/20 22:09, 4F
→
04/20 22:14, , 5F
04/20 22:14, 5F
→
04/20 22:34, , 6F
04/20 22:34, 6F
→
04/20 22:35, , 7F
04/20 22:35, 7F
→
04/20 22:38, , 8F
04/20 22:38, 8F
→
04/20 22:39, , 9F
04/20 22:39, 9F
→
04/20 22:39, , 10F
04/20 22:39, 10F
→
04/21 12:30, , 11F
04/21 12:30, 11F
→
04/21 12:31, , 12F
04/21 12:31, 12F
→
04/21 12:39, , 13F
04/21 12:39, 13F
推
04/21 13:19, , 14F
04/21 13:19, 14F
→
04/21 13:22, , 15F
04/21 13:22, 15F
→
04/21 13:30, , 16F
04/21 13:30, 16F
→
04/21 13:32, , 17F
04/21 13:32, 17F
→
04/21 17:35, , 18F
04/21 17:35, 18F
→
04/21 18:26, , 19F
04/21 18:26, 19F
→
04/21 19:52, , 20F
04/21 19:52, 20F
※ 編輯: LCY1983 (61.220.69.195), 04/22/2015 10:13:03
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章