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
36890cc9
Commit
36890cc9
authored
Mar 14, 2012
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(#1636) Java API: adding undistortPoints() support and smoke test; minor improvements in Java stuff
parent
b232ffcd
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
11 deletions
+52
-11
imgproc.hpp
modules/imgproc/include/opencv2/imgproc/imgproc.hpp
+1
-1
UtilsTest.java
...a/android_test/src/org/opencv/test/android/UtilsTest.java
+4
-4
BruteForceDescriptorMatcherTest.java
...encv/test/features2d/BruteForceDescriptorMatcherTest.java
+23
-5
ImgprocTest.java
...android_test/src/org/opencv/test/imgproc/ImgprocTest.java
+18
-0
gen_java.py
modules/java/gen_java.py
+1
-1
utils+Converters.java
modules/java/src/java/utils+Converters.java
+5
-0
No files found.
modules/imgproc/include/opencv2/imgproc/imgproc.hpp
View file @
36890cc9
...
...
@@ -656,7 +656,7 @@ CV_EXPORTS_W Mat getDefaultNewCameraMatrix( InputArray cameraMatrix, Size imgsiz
bool
centerPrincipalPoint
=
false
);
//! returns points' coordinates after lens distortion correction
CV_EXPORTS
void
undistortPoints
(
InputArray
src
,
OutputArray
dst
,
CV_EXPORTS
_W
void
undistortPoints
(
InputArray
src
,
OutputArray
dst
,
InputArray
cameraMatrix
,
InputArray
distCoeffs
,
InputArray
R
=
noArray
(),
InputArray
P
=
noArray
());
...
...
modules/java/android_test/src/org/opencv/test/android/UtilsTest.java
View file @
36890cc9
...
...
@@ -55,7 +55,7 @@ public class UtilsTest extends OpenCVTestCase {
public
void
testMatToBitmap
()
{
Mat
imgBGR
=
Highgui
.
imread
(
OpenCVTestRunner
.
LENA_PATH
);
assertTrue
(
imgBGR
.
channels
()
==
3
);
assertTrue
(
imgBGR
!=
null
&&
!
imgBGR
.
empty
()
&&
imgBGR
.
channels
()
==
3
);
Mat
m16
=
new
Mat
(
imgBGR
.
rows
(),
imgBGR
.
cols
(),
CvType
.
CV_8UC4
);
Mat
m32
=
new
Mat
(
imgBGR
.
rows
(),
imgBGR
.
cols
(),
CvType
.
CV_8UC4
);
...
...
@@ -71,7 +71,7 @@ public class UtilsTest extends OpenCVTestCase {
// RGBA
Mat
imgRGBA
=
new
Mat
();
Imgproc
.
cvtColor
(
imgBGR
,
imgRGBA
,
Imgproc
.
COLOR_BGR2RGBA
);
assertTrue
(
imgRGBA
.
channels
()
==
4
);
assertTrue
(
!
imgRGBA
.
empty
()
&&
imgRGBA
.
channels
()
==
4
);
bmp16
.
eraseColor
(
Color
.
BLACK
);
m16
.
setTo
(
s0
);
Utils
.
matToBitmap
(
imgRGBA
,
bmp16
);
Utils
.
bitmapToMat
(
bmp16
,
m16
);
...
...
@@ -89,7 +89,7 @@ public class UtilsTest extends OpenCVTestCase {
// RGB
Mat
imgRGB
=
new
Mat
();
Imgproc
.
cvtColor
(
imgBGR
,
imgRGB
,
Imgproc
.
COLOR_BGR2RGB
);
assertTrue
(
imgRGB
.
channels
()
==
3
);
assertTrue
(
!
imgRGB
.
empty
()
&&
imgRGB
.
channels
()
==
3
);
bmp16
.
eraseColor
(
Color
.
BLACK
);
m16
.
setTo
(
s0
);
Utils
.
matToBitmap
(
imgRGB
,
bmp16
);
Utils
.
bitmapToMat
(
bmp16
,
m16
);
...
...
@@ -107,7 +107,7 @@ public class UtilsTest extends OpenCVTestCase {
// Gray
Mat
imgGray
=
new
Mat
();
Imgproc
.
cvtColor
(
imgBGR
,
imgGray
,
Imgproc
.
COLOR_BGR2GRAY
);
assertTrue
(
imgGray
.
channels
()
==
1
);
assertTrue
(
!
imgGray
.
empty
()
&&
imgGray
.
channels
()
==
1
);
Mat
tmp
=
new
Mat
();
bmp16
.
eraseColor
(
Color
.
BLACK
);
m16
.
setTo
(
s0
);
...
...
modules/java/android_test/src/org/opencv/test/features2d/BruteForceDescriptorMatcherTest.java
View file @
36890cc9
package
org
.
opencv
.
test
.
features2d
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
...
...
@@ -13,10 +17,6 @@ import org.opencv.features2d.KeyPoint;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
public
class
BruteForceDescriptorMatcherTest
extends
OpenCVTestCase
{
DescriptorMatcher
matcher
;
...
...
@@ -163,7 +163,25 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
}
public
void
testKnnMatchMatMatListOfListOfDMatchInt
()
{
fail
(
"Not yet implemented"
);
final
int
k
=
3
;
Mat
train
=
getTrainDescriptors
();
Mat
query
=
getQueryDescriptors
();
List
<
List
<
DMatch
>>
matches
=
new
ArrayList
<
List
<
DMatch
>>();
matcher
.
knnMatch
(
query
,
train
,
matches
,
k
);
/*
matcher.add(Arrays.asList(train));
matcher.knnMatch(query, matches, k);
*/
assertEquals
(
query
.
rows
(),
matches
.
size
());
for
(
int
i
=
0
;
i
<
matches
.
size
();
i
++)
{
List
<
DMatch
>
ldm
=
matches
.
get
(
i
);
assertEquals
(
Math
.
min
(
k
,
train
.
rows
()),
ldm
.
size
());
for
(
DMatch
dm
:
ldm
)
{
assertEquals
(
dm
.
queryIdx
,
i
);
}
}
}
public
void
testKnnMatchMatMatListOfListOfDMatchIntMat
()
{
...
...
modules/java/android_test/src/org/opencv/test/imgproc/ImgprocTest.java
View file @
36890cc9
...
...
@@ -2102,6 +2102,24 @@ public class ImgprocTest extends OpenCVTestCase {
assertMatEqual
(
truth
,
dst
,
EPS
);
}
//undistortPoints(List<Point> src, List<Point> dst, Mat cameraMatrix, Mat distCoeffs)
public
void
testUndistortPointsListOfPointListOfPointMatMat
()
{
List
<
Point
>
src
=
new
ArrayList
<
Point
>(
3
);
src
.
add
(
new
Point
(
1
,
2
)
);
src
.
add
(
new
Point
(
3
,
4
)
);
src
.
add
(
new
Point
(-
1
,
-
1
)
);
List
<
Point
>
dst
=
new
ArrayList
<
Point
>();
Mat
cameraMatrix
=
Mat
.
eye
(
3
,
3
,
CvType
.
CV_64FC1
);
Mat
distCoeffs
=
new
Mat
(
8
,
1
,
CvType
.
CV_64FC1
,
new
Scalar
(
0
));
Imgproc
.
undistortPoints
(
src
,
dst
,
cameraMatrix
,
distCoeffs
);
assertEquals
(
src
.
size
(),
dst
.
size
());
for
(
int
i
=
0
;
i
<
src
.
size
();
i
++)
{
//Log.d("UndistortPoints", "s="+src.get(i)+", d="+dst.get(i));
assertTrue
(
src
.
get
(
i
).
equals
(
dst
.
get
(
i
)));
}
}
public
void
testWarpAffineMatMatMatSize
()
{
Mat
src
=
new
Mat
(
3
,
3
,
CvType
.
CV_32F
)
{
{
...
...
modules/java/gen_java.py
View file @
36890cc9
...
...
@@ -514,7 +514,7 @@ func_arg_fix = {
'getAffineTransform'
:
{
'src'
:
'vector_Point2f'
,
'dst'
:
'vector_Point2f'
,
},
'hconcat'
:
{
'src'
:
'vector_Mat'
,
},
'vconcat'
:
{
'src'
:
'vector_Mat'
,
},
'undistortPoints'
:
{
'src'
:
'vector_Point2d'
,
'dst'
:
'vector_Point2d'
}
},
# '', i.e. no class
}
# func_arg_fix
...
...
modules/java/src/java/utils+Converters.java
View file @
36890cc9
...
...
@@ -643,4 +643,9 @@ public class Converters {
}
}
static
{
System
.
loadLibrary
(
"opencv_java"
);
}
}
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