First you need to import the following from JavaCV:
import com.googlecode.javacv.cpp.opencv_core.CvMat;
import static com.googlecode.javacv.cpp.opencv_core.CV_32F;
The main program:
int rows = 2; int cols = 2; CvMat Tab = CvMat.create( rows, cols, CV_32F ); // Manually fill the table Tab.put(0, 0, 1); Tab.put(0, 1, 2); Tab.put(1, 0, -3); Tab.put(1, 1, 4); // Iterate through its elements and print them for(int i=0;i<rows;i++){ for (int j =0;j<cols;j++){ System.out.print(" "+ Tab.get(i,j) ); } System.out.println("\n"); }
Vasko source share