|
|
@ -1,5 +1,8 @@ |
|
|
|
package org.opencv.test.calib3d; |
|
|
|
package org.opencv.test.calib3d; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.util.Log; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.opencv.Converters; |
|
|
|
import org.opencv.core.CvType; |
|
|
|
import org.opencv.core.CvType; |
|
|
|
import org.opencv.core.Mat; |
|
|
|
import org.opencv.core.Mat; |
|
|
|
import org.opencv.core.Point; |
|
|
|
import org.opencv.core.Point; |
|
|
@ -8,6 +11,10 @@ import org.opencv.core.Size; |
|
|
|
import org.opencv.calib3d.Calib3d; |
|
|
|
import org.opencv.calib3d.Calib3d; |
|
|
|
import org.opencv.core.Core; |
|
|
|
import org.opencv.core.Core; |
|
|
|
import org.opencv.test.OpenCVTestCase; |
|
|
|
import org.opencv.test.OpenCVTestCase; |
|
|
|
|
|
|
|
import org.opencv.test.OpenCVTestRunner; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
public class calib3dTest extends OpenCVTestCase { |
|
|
|
public class calib3dTest extends OpenCVTestCase { |
|
|
|
|
|
|
|
|
|
|
@ -265,7 +272,23 @@ public class calib3dTest extends OpenCVTestCase { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testFindHomographyMatMat() { |
|
|
|
public void testFindHomographyMatMat() { |
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
|
|
|
|
List<Point> originalPoints = new ArrayList<Point>(); |
|
|
|
|
|
|
|
List<Point> transformedPoints = new ArrayList<Point>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 20; i++){ |
|
|
|
|
|
|
|
double x = Math.random() * 100 - 50; |
|
|
|
|
|
|
|
double y = Math.random() * 100 - 50; |
|
|
|
|
|
|
|
originalPoints.add(new Point(x,y)); |
|
|
|
|
|
|
|
transformedPoints.add(new Point(y,x)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mat hmg = Calib3d.findHomography(Converters.vector_Point2f_to_Mat(originalPoints), Converters.vector_Point2f_to_Mat(transformedPoints)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
truth = new Mat(3,3, CvType.CV_64F); |
|
|
|
|
|
|
|
truth.put(0, 0, 0,1,0,1,0,0,0,0,1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertMatEqual(truth, hmg, EPS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testFindHomographyMatMatInt() { |
|
|
|
public void testFindHomographyMatMatInt() { |
|
|
|