Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
cd8dfd6c
Commit
cd8dfd6c
authored
Apr 04, 2012
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java API: fixing Calib3d tests
parent
51338ec7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
19 deletions
+21
-19
Calib3dTest.java
...android_test/src/org/opencv/test/calib3d/Calib3dTest.java
+21
-19
No files found.
modules/java/android_test/src/org/opencv/test/calib3d/Calib3dTest.java
View file @
cd8dfd6c
package
org
.
opencv
.
test
.
calib3d
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.opencv.calib3d.Calib3d
;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.CvVectorPoint2f
;
import
org.opencv.core.CvVectorPoint3f
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Point
;
import
org.opencv.core.Point3
;
import
org.opencv.core.Scalar
;
import
org.opencv.core.Size
;
import
org.opencv.test.OpenCVTestCase
;
...
...
@@ -235,15 +233,16 @@ public class Calib3dTest extends OpenCVTestCase {
}
public
void
testFindFundamentalMatListOfPointListOfPoint
()
{
List
<
Point
>
pts1
=
new
ArrayList
<
Point
>();
List
<
Point
>
pts2
=
new
ArrayList
<
Point
>();
int
minFundamentalMatPoints
=
8
;
CvVectorPoint2f
pts1
=
new
CvVectorPoint2f
();
CvVectorPoint2f
pts2
=
new
CvVectorPoint2f
(
minFundamentalMatPoints
);
for
(
int
i
=
0
;
i
<
minFundamentalMatPoints
;
i
++)
{
double
x
=
Math
.
random
()
*
100
-
50
;
double
y
=
Math
.
random
()
*
100
-
50
;
pts1
.
add
(
new
Point
(
x
,
y
));
pts2
.
add
(
new
Point
(
x
,
y
));
pts1
.
push_back
(
new
CvVectorPoint2f
(
new
Point
(
x
,
y
)));
//
add(new Point(x, y));
pts2
.
put
(
i
,
0
,
x
,
y
);
//
add(new Point(x, y));
}
Mat
fm
=
Calib3d
.
findFundamentalMat
(
pts1
,
pts2
);
...
...
@@ -270,14 +269,16 @@ public class Calib3dTest extends OpenCVTestCase {
}
public
void
testFindHomographyListOfPointListOfPoint
()
{
List
<
Point
>
originalPoints
=
new
ArrayList
<
Point
>();
List
<
Point
>
transformedPoints
=
new
ArrayList
<
Point
>();
final
int
NUM
=
20
;
CvVectorPoint2f
originalPoints
=
new
CvVectorPoint2f
(
NUM
);
CvVectorPoint2f
transformedPoints
=
new
CvVectorPoint2f
(
NUM
);
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
for
(
int
i
=
0
;
i
<
NUM
;
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
));
originalPoints
.
put
(
i
,
0
,
x
,
y
);
//
add(new Point(x, y));
transformedPoints
.
put
(
i
,
0
,
x
,
y
);
//
add(new Point(y, x));
}
Mat
hmg
=
Calib3d
.
findHomography
(
originalPoints
,
transformedPoints
);
...
...
@@ -497,15 +498,16 @@ public class Calib3dTest extends OpenCVTestCase {
intrinsics
.
put
(
0
,
2
,
640
/
2
);
intrinsics
.
put
(
1
,
2
,
480
/
2
);
List
<
Point3
>
points3d
=
new
ArrayList
<
Point3
>();
List
<
Point
>
points2d
=
new
ArrayList
<
Point
>();
int
minPnpPointsNum
=
4
;
final
int
minPnpPointsNum
=
4
;
CvVectorPoint3f
points3d
=
new
CvVectorPoint3f
(
minPnpPointsNum
);
CvVectorPoint2f
points2d
=
new
CvVectorPoint2f
(
minPnpPointsNum
);
for
(
int
i
=
0
;
i
<
minPnpPointsNum
;
i
++)
{
double
x
=
Math
.
random
()
*
100
-
50
;
double
y
=
Math
.
random
()
*
100
-
50
;
points2d
.
add
(
new
Point
(
x
,
y
));
points3d
.
add
(
new
Point3
(
0
,
y
,
x
));
points2d
.
put
(
i
,
0
,
x
,
y
);
//
add(new Point(x, y));
points3d
.
put
(
i
,
0
,
0
,
y
,
x
);
//
add(new Point3(0, y, x));
}
Mat
rvec
=
new
Mat
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment