嘿,我已經嘗試了很多搜索與type_id「opencv-image」讀取xml文件,我在這裏看到的所有是「opencv矩陣」和所有可用的幫助是無用的我。 請幫我從xml文件中讀取圖像矩陣。使用opencv讀取xml文件type_id opencv-image使用opencv
我在這裏粘貼我的XML文件的上半部分的一些想法。
<?xml version="1.0"?>
<opencv_storage>
<depthImg190 type_id="opencv-image">
<width>320</width>
<height>240</height>
<origin>top-left</origin>
<layout>interleaved</layout>
<dt>w</dt>
<data>
0 0 0 0 27120 27384 27120 27120 27384 27120 27120 27120 27120 27384
27384 27664 27664 27944 27944 27664 27664 27944 27944 27944 28224
27944 27944 28224 28224 28224 28224 28520 28816 29120 29120 29120
29120 29120 29120 29120 29432 29744 30072 30072 29744 29744 30072
30072 30072 30400 30400 30736 30736 31080 31080 31080 31440 31440
31440 31440 31800 31800 31800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 27120 27120 27120 27120 27384 27384 27384 27384 27384 27384
</depthImg190>
</opencv_storage>
我已經使用的代碼
FileStorage f;
Mat m;
f.open("temp.xml", FileStorage::READ);
f["depthImg190"] >> m;
f.release();
但我面臨一個異常「opencv的Errorr:在簡歷::閱讀,文件錯誤的參數<未知的數組類型> ....... 。\ opencv \ modules \ core \ persistence.cpp,5535行「。
任何幫助將appriciated
其中一個問題是,上面的xml是一個序列化的* IplImage *,而不是一個cv :: Mat。它不僅是「opencv-image」部分,寬度爲<-> cols,高度爲<->行,如果這是傳統數據,那麼除了cvLoad(yukk)之外,您將沒有其他機會。如果你真的寫了這個,你應該在第一個地方改變那個*部分。 – berak 2014-10-24 06:47:29
@berak你是非常正確的,問題是我不寫這些數據。我只是將這個數據集用於我的研究工作,我不得不使用這個數據集。 I'v完成所有,但在這裏我卡住了,當我在循環中使用cvLoad獲取通過 讀取文件IplImage * depth =(IplImage *)cvLoad(getPath(filename)); 其中getPath(文件名)返回「data \\ depth \\ depthImg190.xml」 ,但cvLoad沒有正確讀取文件,但是當我使用 IplImage * depth =(IplImage *)cvLoad(「data \\ depth \\ depthImg190.xml「);它正在正確閱讀。 – Zainb 2014-10-24 08:47:01
什麼可以幫助我在這裏,我沒有得到,如果它是工作時,我給文件作爲硬代碼字符,但不只與變量工作。 – Zainb 2014-10-24 08:50:01