Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

your for loop is faulty, i guess, you wanted something like this instead:

for(int i=0;i<destination.rows();i++){
    for(int j=0;j<destination.cols();j++){
        System.out.println(destination.get(i,j));
    }
}

but it's better, to use Mat.dump(), to get a string representation:

// setup some demo data:
byte []data = {1,2,3,4,5,6,7,8,9};
Mat m = new Mat(3,3,CvType.CV_8U);
m.put(0,0,data);

// print info:    
System.out.println(m);
System.out.println(m.dump());


 // (ant) output:
 [java] Mat [ 3*3*CV_8UC1, isCont=true, isSubmat=false, nativeObj=0x3dacbe8, dataAddr=0x3da69e0 ]
 [java] [  1,   2,   3;
 [java]    4,   5,   6;
 [java]    7,   8,   9]

your for loop is faulty, i guess, you wanted something like this instead:

for(int i=0;i<destination.rows();i++){
    for(int j=0;j<destination.cols();j++){
        System.out.println(destination.get(i,j));
    }
}

but it's better, to use Mat.dump(), to get a string representation:

// setup some demo data:
byte []data = {1,2,3,4,5,6,7,8,9};
Mat m = new Mat(3,3,CvType.CV_8U);
m.put(0,0,data);

// print info:    
System.out.println(m);
System.out.println(m.dump());


 // (ant) output:
 [java] Mat [ 3*3*CV_8UC1, isCont=true, isSubmat=false, nativeObj=0x3dacbe8, dataAddr=0x3da69e0 ]
 [java] [  1,   2,   3;
 [java]    4,   5,   6;
 [java]    7,   8,   9]