Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

imho, your initialization for W fails here:

    Mat W = new Mat(new Size(3,3), CvType.CV_64FC1, new Scalar(W_Values) );

a Scalar is more like a 'pixel', so since we have a 1channel mat, it took only the 1st element of the array supplied.

better, put() the array:

    Mat W = new Mat(new Size(3,3), CvType.CV_64FC1 );
    double[] W_Values = {0,-1,0,1,0,0,0,0,1};
    W.put(0, 0, W_Values);
    System.out.println(W.dump());

[0, -1, 0;
 1, 0, 0;
 0, 0, 1]

-----------------------

ha, i even tried it ;)

E [4.209958176688844e-008, -8.477216249742946e-008, 9.132798068178794e-005;
 3.165719895008366e-007, 6.437858397735847e-007, -0.0006976204595236443;
 0.0004532506630569588, -0.0009224427024602799, 1]
w [1.000000775675665;  6.327691571456636e-007;  5.276344988797871e-010]
u [9.132795888347626e-005, -0.001114037573966938, 0.9999993752895485;
 -0.0006976200003051577, -0.9999991361942089, -0.001113973595355074;
 0.999999752492739, -0.0006975178275599385, -9.210505488654289e-005]
vt [0.0004532499822970647, -0.0009224422154929804, 0.9999994718322668;
 -0.9999998060113785, -0.000427666901476275, 0.000452855635551369;
 0.0004272489424406606, -0.9999994831005566, -0.0009226358765652097]
R [0, -1.027635287872488e-006, 0;
 0.0006976198649748155, 0, -0;
 0, 0, 8.497942805133225e-008]
T [0.9999993752895485;  -0.001113973595355074;  -9.210505488654289e-005]

imho, your initialization for W fails here:

    Mat W = new Mat(new Size(3,3), CvType.CV_64FC1, new Scalar(W_Values) );

a Scalar is more like a 'pixel', so since we have a 1channel mat, it took only the 1st element of the array supplied.

better, put() the array:

    Mat W = new Mat(new Size(3,3), CvType.CV_64FC1 );
    double[] W_Values = {0,-1,0,1,0,0,0,0,1};
    W.put(0, 0, W_Values);
    System.out.println(W.dump());

[0, -1, 0;
 1, 0, 0;
 0, 0, 1]

-----------------------

ha, i even tried it ;)

E [4.209958176688844e-008, -8.477216249742946e-008, 9.132798068178794e-005;
 3.165719895008366e-007, 6.437858397735847e-007, -0.0006976204595236443;
 0.0004532506630569588, -0.0009224427024602799, 1]
w [1.000000775675665;  6.327691571456636e-007;  5.276344988797871e-010]
u [9.132795888347626e-005, -0.001114037573966938, 0.9999993752895485;
 -0.0006976200003051577, -0.9999991361942089, -0.001113973595355074;
 0.999999752492739, -0.0006975178275599385, -9.210505488654289e-005]
vt [0.0004532499822970647, -0.0009224422154929804, 0.9999994718322668;
 -0.9999998060113785, -0.000427666901476275, 0.000452855635551369;
 0.0004272489424406606, -0.9999994831005566, -0.0009226358765652097]
R [0, -1.027635287872488e-006, 0;
 0.0006976198649748155, 0, -0;
 0, 0, 8.497942805133225e-008]
T [0.9999993752895485;  -0.001113973595355074;  -9.210505488654289e-005]