loading saved .xml file in android
this is my load .xml code but error occured
public Mat readmat(String tag){
if( isWrite ) {
System.err.println("Try read from file with write flags");
return null;
}
NodeList nodelist = doc.getElementsByTagName(tag);
Mat readMat = null;
for( int i = 0 ; i<nodelist.getLength() ; i++ ){
Node node = nodelist.item(i);
if( node.getNodeType() == Node.ELEMENT_NODE ) {
Element element = (Element)node;
String type_id = element.getAttribute("type_id");
if( "opencv-matrix".equals(type_id) == false) {
System.out.println("Fault type_id ");
}
String rowsStr = element.getElementsByTagName("rows").item(0).getTextContent();
String colsStr = element.getElementsByTagName("cols").item(0).getTextContent();
String dtStr = element.getElementsByTagName("dt").item(0).getTextContent();
String dataStr = element.getElementsByTagName("data").item(0).getTextContent();
int rows = Integer.parseInt(rowsStr);
int cols = Integer.parseInt(colsStr);
int type = CvType.CV_8U;
if( "d".equals(dtStr) ) {
type = CvType.CV_64F;
readMat = new Mat( rows, cols, type );
byte[] data = Base64.decode(dataStr.getBytes(), Base64.DEFAULT);
Log.i("FC_MainAct", ""+data.length);
readMat.put(0, 0, data);
}
}
}
return readMat;
and this is my log
1st guess: byte[] data is the problem, your Mat is of type double.
( a double Mat, encoded base64, in xml ? baaaaa. it can't get more useless complicated, can it?)