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
0c45a5ad
Commit
0c45a5ad
authored
Apr 05, 2012
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java API: minor bug-fixes and improvements in CvVector-s and tests
parent
4ee2c486
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
89 additions
and
72 deletions
+89
-72
OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+14
-5
Calib3dTest.java
...android_test/src/org/opencv/test/calib3d/Calib3dTest.java
+10
-5
CoreTest.java
.../java/android_test/src/org/opencv/test/core/CoreTest.java
+5
-5
BRIEFDescriptorExtractorTest.java
.../opencv/test/features2d/BRIEFDescriptorExtractorTest.java
+6
-6
BruteForceDescriptorMatcherTest.java
...encv/test/features2d/BruteForceDescriptorMatcherTest.java
+16
-14
ImgprocTest.java
...android_test/src/org/opencv/test/imgproc/ImgprocTest.java
+2
-1
ConvertersTest.java
...ndroid_test/src/org/opencv/test/utils/ConvertersTest.java
+2
-1
core+CvVectorByte.java
modules/java/src/java/core+CvVectorByte.java
+2
-2
core+CvVectorDMatch.java
modules/java/src/java/core+CvVectorDMatch.java
+2
-2
core+CvVectorDouble.java
modules/java/src/java/core+CvVectorDouble.java
+7
-7
core+CvVectorFloat.java
modules/java/src/java/core+CvVectorFloat.java
+2
-2
core+CvVectorInt.java
modules/java/src/java/core+CvVectorInt.java
+7
-7
core+CvVectorKeyPoint.java
modules/java/src/java/core+CvVectorKeyPoint.java
+3
-3
core+CvVectorPoint.java
modules/java/src/java/core+CvVectorPoint.java
+2
-2
core+CvVectorPoint2f.java
modules/java/src/java/core+CvVectorPoint2f.java
+2
-2
core+CvVectorPoint3.java
modules/java/src/java/core+CvVectorPoint3.java
+2
-2
core+CvVectorPoint3f.java
modules/java/src/java/core+CvVectorPoint3f.java
+2
-2
core+CvVectorRect.java
modules/java/src/java/core+CvVectorRect.java
+2
-2
FdView.java
...roid/face-detection/src/org/opencv/samples/fd/FdView.java
+1
-2
No files found.
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
View file @
0c45a5ad
...
...
@@ -25,7 +25,10 @@ import org.opencv.highgui.Highgui;
public
class
OpenCVTestCase
extends
TestCase
{
protected
static
final
int
matSize
=
10
;
//change to 'true' to unblock fail on fail("Not yet implemented")
protected
static
final
boolean
passNYI
=
true
;
protected
static
final
int
matSize
=
10
;
protected
static
final
double
EPS
=
0.001
;
protected
static
final
double
weakEPS
=
0.5
;
...
...
@@ -181,6 +184,12 @@ public class OpenCVTestCase extends TestCase {
return
m
;
}
public
static
void
fail
(
String
msg
)
{
if
(
msg
==
"Not yet implemented"
&&
passNYI
)
return
;
TestCase
.
fail
(
msg
);
}
public
static
<
E
extends
Number
>
void
assertListEquals
(
List
<
E
>
list1
,
List
<
E
>
list2
)
{
if
(
list1
.
size
()
!=
list2
.
size
())
{
throw
new
UnsupportedOperationException
();
...
...
@@ -325,10 +334,10 @@ public class OpenCVTestCase extends TestCase {
assertTrue
(
msg
,
Math
.
abs
(
expected
.
val
[
3
]
-
actual
.
val
[
3
])
<
eps
);
}
public
static
void
assert
ListDMatchEquals
(
List
<
DMatch
>
expected
,
List
<
DMatch
>
actual
,
double
epsilon
)
{
assertEquals
(
expected
.
size
(),
actual
.
size
()
);
for
(
int
i
=
0
;
i
<
expected
.
size
()
;
i
++)
assertDMatchEqual
(
expected
.
get
(
i
),
actual
.
get
(
i
)
,
epsilon
);
public
static
void
assert
ArrayDMatchEquals
(
DMatch
[]
expected
,
DMatch
[]
actual
,
double
epsilon
)
{
assertEquals
(
expected
.
length
,
actual
.
length
);
for
(
int
i
=
0
;
i
<
expected
.
length
;
i
++)
assertDMatchEqual
(
expected
[
i
],
actual
[
i
]
,
epsilon
);
}
public
static
void
assertPointEquals
(
Point
expected
,
Point
actual
,
double
eps
)
{
...
...
modules/java/android_test/src/org/opencv/test/calib3d/Calib3dTest.java
View file @
0c45a5ad
...
...
@@ -236,7 +236,8 @@ public class Calib3dTest extends OpenCVTestCase {
int
minFundamentalMatPoints
=
8
;
CvVectorPoint2f
pts1
=
new
CvVectorPoint2f
();
CvVectorPoint2f
pts2
=
new
CvVectorPoint2f
(
minFundamentalMatPoints
);
CvVectorPoint2f
pts2
=
new
CvVectorPoint2f
();
pts2
.
alloc
(
minFundamentalMatPoints
);
for
(
int
i
=
0
;
i
<
minFundamentalMatPoints
;
i
++)
{
double
x
=
Math
.
random
()
*
100
-
50
;
...
...
@@ -271,8 +272,10 @@ public class Calib3dTest extends OpenCVTestCase {
public
void
testFindHomographyListOfPointListOfPoint
()
{
final
int
NUM
=
20
;
CvVectorPoint2f
originalPoints
=
new
CvVectorPoint2f
(
NUM
);
CvVectorPoint2f
transformedPoints
=
new
CvVectorPoint2f
(
NUM
);
CvVectorPoint2f
originalPoints
=
new
CvVectorPoint2f
();
originalPoints
.
alloc
(
NUM
);
CvVectorPoint2f
transformedPoints
=
new
CvVectorPoint2f
();
transformedPoints
.
alloc
(
NUM
);
for
(
int
i
=
0
;
i
<
NUM
;
i
++)
{
double
x
=
Math
.
random
()
*
100
-
50
;
...
...
@@ -500,8 +503,10 @@ public class Calib3dTest extends OpenCVTestCase {
final
int
minPnpPointsNum
=
4
;
CvVectorPoint3f
points3d
=
new
CvVectorPoint3f
(
minPnpPointsNum
);
CvVectorPoint2f
points2d
=
new
CvVectorPoint2f
(
minPnpPointsNum
);
CvVectorPoint3f
points3d
=
new
CvVectorPoint3f
();
points3d
.
alloc
(
minPnpPointsNum
);
CvVectorPoint2f
points2d
=
new
CvVectorPoint2f
();
points2d
.
alloc
(
minPnpPointsNum
);
for
(
int
i
=
0
;
i
<
minPnpPointsNum
;
i
++)
{
double
x
=
Math
.
random
()
*
100
-
50
;
...
...
modules/java/android_test/src/org/opencv/test/core/CoreTest.java
View file @
0c45a5ad
...
...
@@ -507,7 +507,7 @@ public class CoreTest extends OpenCVTestCase {
new
Point
(
4
,
6
),
new
Point
(
4
,
6
)
};
assertArrayPointsEquals
(
truth
,
pts
.
toArray
(
n
ew
Point
[
0
]
),
EPS
);
assertArrayPointsEquals
(
truth
,
pts
.
toArray
(
n
ull
),
EPS
);
}
public
void
testEllipseMatPointSizeDoubleDoubleDoubleScalar
()
{
...
...
@@ -1204,8 +1204,8 @@ public class CoreTest extends OpenCVTestCase {
double
expectedDev
[]
=
new
double
[]
{
33.74205485167219
,
52.8734582803278
,
49.01569488056406
};
assertArrayEquals
(
expectedMean
,
mean
.
toArray
(
null
),
EPS
);
assertArrayEquals
(
expectedDev
,
stddev
.
toArray
(
null
),
EPS
);
assertArrayEquals
(
expectedMean
,
mean
.
to
Primitive
Array
(
null
),
EPS
);
assertArrayEquals
(
expectedDev
,
stddev
.
to
Primitive
Array
(
null
),
EPS
);
}
public
void
testMeanStdDevMatMatMatMat
()
{
...
...
@@ -1222,8 +1222,8 @@ public class CoreTest extends OpenCVTestCase {
double
expectedMean
[]
=
new
double
[]
{
33
d
};
double
expectedDev
[]
=
new
double
[]
{
0
d
};
assertArrayEquals
(
expectedMean
,
mean
.
toArray
(
null
),
EPS
);
assertArrayEquals
(
expectedDev
,
stddev
.
toArray
(
null
),
EPS
);
assertArrayEquals
(
expectedMean
,
mean
.
to
Primitive
Array
(
null
),
EPS
);
assertArrayEquals
(
expectedDev
,
stddev
.
to
Primitive
Array
(
null
),
EPS
);
}
public
void
testMerge
()
{
...
...
modules/java/android_test/src/org/opencv/test/features2d/BRIEFDescriptorExtractorTest.java
View file @
0c45a5ad
...
...
@@ -2,6 +2,7 @@ package org.opencv.test.features2d;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.CvVectorKeyPoint
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
...
...
@@ -10,9 +11,6 @@ import org.opencv.features2d.KeyPoint;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
import
java.util.Arrays
;
import
java.util.List
;
public
class
BRIEFDescriptorExtractorTest
extends
OpenCVTestCase
{
DescriptorExtractor
extractor
;
...
...
@@ -40,7 +38,7 @@ public class BRIEFDescriptorExtractorTest extends OpenCVTestCase {
public
void
testComputeMatListOfKeyPointMat
()
{
KeyPoint
point
=
new
KeyPoint
(
55.775577545166016f
,
44.224422454833984f
,
16
,
9.754629f
,
8617.863f
,
1
,
-
1
);
List
<
KeyPoint
>
keypoints
=
Arrays
.
asLis
t
(
point
);
CvVectorKeyPoint
keypoints
=
new
CvVectorKeyPoin
t
(
point
);
Mat
img
=
getTestImg
();
Mat
descriptors
=
new
Mat
();
...
...
@@ -48,8 +46,10 @@ public class BRIEFDescriptorExtractorTest extends OpenCVTestCase {
Mat
truth
=
new
Mat
(
1
,
32
,
CvType
.
CV_8UC1
)
{
{
put
(
0
,
0
,
96
,
0
,
76
,
24
,
47
,
182
,
68
,
137
,
149
,
195
,
67
,
16
,
187
,
224
,
74
,
8
,
82
,
169
,
87
,
70
,
44
,
4
,
192
,
56
,
13
,
128
,
44
,
106
,
146
,
72
,
194
,
245
);
put
(
0
,
0
,
96
,
0
,
76
,
24
,
47
,
182
,
68
,
137
,
149
,
195
,
67
,
16
,
187
,
224
,
74
,
8
,
82
,
169
,
87
,
70
,
44
,
4
,
192
,
56
,
13
,
128
,
44
,
106
,
146
,
72
,
194
,
245
);
}
};
...
...
modules/java/android_test/src/org/opencv/test/features2d/BruteForceDescriptorMatcherTest.java
View file @
0c45a5ad
...
...
@@ -6,6 +6,8 @@ import java.util.List;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.CvVectorDMatch
;
import
org.opencv.core.CvVectorKeyPoint
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
...
...
@@ -33,7 +35,7 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
private
Mat
getQueryDescriptors
()
{
Mat
img
=
getQueryImg
();
List
<
KeyPoint
>
keypoints
=
new
ArrayList
<
KeyPoint
>
();
CvVectorKeyPoint
keypoints
=
new
CvVectorKeyPoint
();
Mat
descriptors
=
new
Mat
();
FeatureDetector
detector
=
FeatureDetector
.
create
(
FeatureDetector
.
SURF
);
...
...
@@ -59,7 +61,7 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
private
Mat
getTrainDescriptors
()
{
Mat
img
=
getTrainImg
();
List
<
KeyPoint
>
keypoints
=
Arrays
.
asLis
t
(
new
KeyPoint
(
50
,
50
,
16
,
0
,
20000
,
1
,
-
1
),
new
KeyPoint
(
42
,
42
,
16
,
160
,
10000
,
1
,
-
1
));
CvVectorKeyPoint
keypoints
=
new
CvVectorKeyPoin
t
(
new
KeyPoint
(
50
,
50
,
16
,
0
,
20000
,
1
,
-
1
),
new
KeyPoint
(
42
,
42
,
16
,
160
,
10000
,
1
,
-
1
));
Mat
descriptors
=
new
Mat
();
DescriptorExtractor
extractor
=
DescriptorExtractor
.
create
(
DescriptorExtractor
.
SURF
);
...
...
@@ -166,7 +168,7 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
final
int
k
=
3
;
Mat
train
=
getTrainDescriptors
();
Mat
query
=
getQueryDescriptors
();
List
<
List
<
DMatch
>>
matches
=
new
ArrayList
<
List
<
DMatch
>
>();
List
<
CvVectorDMatch
>
matches
=
new
ArrayList
<
CvVectorDMatch
>();
matcher
.
knnMatch
(
query
,
train
,
matches
,
k
);
/*
matcher.add(Arrays.asList(train));
...
...
@@ -175,9 +177,9 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
assertEquals
(
query
.
rows
(),
matches
.
size
());
for
(
int
i
=
0
;
i
<
matches
.
size
();
i
++)
{
List
<
DMatch
>
l
dm
=
matches
.
get
(
i
);
assertEquals
(
Math
.
min
(
k
,
train
.
rows
()),
ldm
.
size
());
for
(
DMatch
dm
:
ldm
)
CvVectorDMatch
v
dm
=
matches
.
get
(
i
);
assertEquals
(
Math
.
min
(
k
,
train
.
rows
()),
vdm
.
total
());
for
(
DMatch
dm
:
vdm
.
toArray
(
null
)
)
{
assertEquals
(
dm
.
queryIdx
,
i
);
}
...
...
@@ -195,34 +197,34 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
public
void
testMatchMatListOfDMatch
()
{
Mat
train
=
getTrainDescriptors
();
Mat
query
=
getQueryDescriptors
();
List
<
DMatch
>
matches
=
new
ArrayList
<
DMatch
>
();
CvVectorDMatch
matches
=
new
CvVectorDMatch
();
matcher
.
add
(
Arrays
.
asList
(
train
));
matcher
.
match
(
query
,
matches
);
assert
ListDMatchEquals
(
Arrays
.
asList
(
truth
),
matches
,
EPS
);
assert
ArrayDMatchEquals
(
truth
,
matches
.
toArray
(
null
)
,
EPS
);
}
public
void
testMatchMatListOfDMatchListOfMat
()
{
Mat
train
=
getTrainDescriptors
();
Mat
query
=
getQueryDescriptors
();
Mat
mask
=
getMaskImg
();
List
<
DMatch
>
matches
=
new
ArrayList
<
DMatch
>
();
CvVectorDMatch
matches
=
new
CvVectorDMatch
();
matcher
.
add
(
Arrays
.
asList
(
train
));
matcher
.
match
(
query
,
matches
,
Arrays
.
asList
(
mask
));
assert
ListDMatchEquals
(
Arrays
.
asList
(
truth
[
0
],
truth
[
1
]),
matches
,
EPS
);
assert
ArrayDMatchEquals
(
Arrays
.
copyOfRange
(
truth
,
0
,
2
),
matches
.
toArray
(
null
)
,
EPS
);
}
public
void
testMatchMatMatListOfDMatch
()
{
Mat
train
=
getTrainDescriptors
();
Mat
query
=
getQueryDescriptors
();
List
<
DMatch
>
matches
=
new
ArrayList
<
DMatch
>
();
CvVectorDMatch
matches
=
new
CvVectorDMatch
();
matcher
.
match
(
query
,
train
,
matches
);
assert
ListDMatchEquals
(
Arrays
.
asList
(
truth
),
matches
,
EPS
);
assert
ArrayDMatchEquals
(
truth
,
matches
.
toArray
(
null
)
,
EPS
);
// OpenCVTestRunner.Log("matches found: " + matches.size());
// for (DMatch m : matches)
...
...
@@ -233,11 +235,11 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
Mat
train
=
getTrainDescriptors
();
Mat
query
=
getQueryDescriptors
();
Mat
mask
=
getMaskImg
();
List
<
DMatch
>
matches
=
new
ArrayList
<
DMatch
>
();
CvVectorDMatch
matches
=
new
CvVectorDMatch
();
matcher
.
match
(
query
,
train
,
matches
,
mask
);
assert
ListDMatchEquals
(
Arrays
.
asList
(
truth
[
0
],
truth
[
1
]),
matches
,
EPS
);
assert
ArrayDMatchEquals
(
Arrays
.
copyOfRange
(
truth
,
0
,
2
),
matches
.
toArray
(
null
)
,
EPS
);
}
public
void
testRadiusMatchMatListOfListOfDMatchFloat
()
{
...
...
modules/java/android_test/src/org/opencv/test/imgproc/ImgprocTest.java
View file @
0c45a5ad
...
...
@@ -6,6 +6,7 @@ import java.util.List;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.CvVectorPoint2f
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Point
;
import
org.opencv.core.Rect
;
...
...
@@ -141,7 +142,7 @@ public class ImgprocTest extends OpenCVTestCase {
}
public
void
testApproxPolyDP
()
{
List
<
Point
>
curve
=
new
ArrayList
<
Point
>
(
5
);
CvVectorPoint2f
curve
=
new
CvVectorPoint2f
(
5
);
curve
.
add
(
new
Point
(
1
,
3
));
curve
.
add
(
new
Point
(
2
,
4
));
curve
.
add
(
new
Point
(
3
,
5
));
...
...
modules/java/android_test/src/org/opencv/test/utils/ConvertersTest.java
View file @
0c45a5ad
...
...
@@ -44,7 +44,8 @@ public class ConvertersTest extends OpenCVTestCase {
truth
.
add
(
new
DMatch
(
2
,
3
,
5
,
6
));
truth
.
add
(
new
DMatch
(
3
,
1
,
8
,
12
));
truth
.
add
(
new
DMatch
(
4
,
9
,
5
,
15
));
assertListDMatchEquals
(
truth
,
matches
,
EPS
);
//assertListDMatchEquals(truth, matches, EPS);
fail
(
"Not yet implemented"
);
}
public
void
testMat_to_vector_float
()
{
...
...
modules/java/src/java/core+CvVectorByte.java
View file @
0c45a5ad
...
...
@@ -8,7 +8,7 @@ public class CvVectorByte extends CvVector {
}
public
CvVectorByte
()
{
super
(
_d
,
1
);
this
(
1
);
}
public
CvVectorByte
(
int
ch
,
long
addr
)
{
...
...
@@ -32,7 +32,7 @@ public class CvVectorByte extends CvVector {
}
}
public
byte
[]
toArray
(
byte
[]
a
)
{
public
byte
[]
to
Primitive
Array
(
byte
[]
a
)
{
int
cnt
=
(
int
)
total
()
*
channels
;
if
(
cnt
==
0
)
return
new
byte
[
0
];
//null;
...
...
modules/java/src/java/core+CvVectorDMatch.java
View file @
0c45a5ad
...
...
@@ -25,7 +25,7 @@ public class CvVectorDMatch extends CvVectorFloat {
create
(
cnt
);
float
buff
[]
=
new
float
[
_ch
*
cnt
];
for
(
int
i
=
0
;
i
<
cnt
;
i
++)
{
DMatch
m
=
a
[
i
];
DMatch
m
=
a
[
i
];
buff
[
_ch
*
i
+
0
]
=
m
.
queryIdx
;
buff
[
_ch
*
i
+
1
]
=
m
.
trainIdx
;
buff
[
_ch
*
i
+
2
]
=
m
.
imgIdx
;
...
...
@@ -35,7 +35,7 @@ public class CvVectorDMatch extends CvVectorFloat {
}
public
DMatch
[]
toArray
(
DMatch
[]
a
)
{
float
buff
[]
=
super
.
to
Array
(
null
);
float
buff
[]
=
super
.
toPrimitive
Array
(
null
);
if
(
buff
.
length
==
0
)
return
new
DMatch
[
0
];
//null;
int
cnt
=
buff
.
length
/
_ch
;
...
...
modules/java/src/java/core+CvVectorDouble.java
View file @
0c45a5ad
package
org
.
opencv
.
core
;
public
class
CvVectorDouble
extends
CvVector
{
private
static
final
int
_d
=
CvType
.
CV_64F
;
private
static
final
int
_d
=
CvType
.
CV_64F
;
public
CvVectorDouble
(
int
ch
)
{
super
(
_d
,
ch
);
}
public
CvVectorDouble
()
{
super
(
_d
,
1
);
this
(
1
);
}
public
CvVectorDouble
(
int
ch
,
long
addr
)
{
...
...
@@ -22,13 +22,13 @@ public class CvVectorDouble extends CvVector {
public
CvVectorDouble
(
int
ch
,
double
[]
a
)
{
super
(
_d
,
ch
);
if
(
a
!=
null
)
{
int
cnt
=
a
.
length
/
ch
;
create
(
cnt
);
put
(
0
,
0
,
a
);
int
cnt
=
a
.
length
/
ch
;
create
(
cnt
);
put
(
0
,
0
,
a
);
}
}
public
double
[]
toArray
(
double
[]
a
)
{
public
double
[]
to
Primitive
Array
(
double
[]
a
)
{
int
cnt
=
(
int
)
total
()
*
channels
;
if
(
cnt
==
0
)
return
new
double
[
0
];
//null;
...
...
modules/java/src/java/core+CvVectorFloat.java
View file @
0c45a5ad
...
...
@@ -8,7 +8,7 @@ public class CvVectorFloat extends CvVector {
}
public
CvVectorFloat
()
{
super
(
_d
,
1
);
this
(
1
);
}
public
CvVectorFloat
(
int
ch
,
long
addr
)
{
...
...
@@ -32,7 +32,7 @@ public class CvVectorFloat extends CvVector {
}
}
public
float
[]
toArray
(
float
[]
a
)
{
public
float
[]
to
Primitive
Array
(
float
[]
a
)
{
int
cnt
=
(
int
)
total
()
*
channels
;
if
(
cnt
==
0
)
return
new
float
[
0
];
//null;
...
...
modules/java/src/java/core+CvVectorInt.java
View file @
0c45a5ad
...
...
@@ -2,14 +2,14 @@ package org.opencv.core;
public
class
CvVectorInt
extends
CvVector
{
private
static
final
int
_d
=
CvType
.
CV_32S
;
private
static
final
int
_d
=
CvType
.
CV_32S
;
public
CvVectorInt
(
int
ch
)
{
super
(
_d
,
ch
);
}
public
CvVectorInt
()
{
super
(
_d
,
1
);
this
(
1
);
}
public
CvVectorInt
(
int
ch
,
long
addr
)
{
...
...
@@ -23,13 +23,13 @@ public class CvVectorInt extends CvVector {
public
CvVectorInt
(
int
ch
,
int
[]
a
)
{
super
(
_d
,
ch
);
if
(
a
!=
null
)
{
int
cnt
=
a
.
length
/
ch
;
create
(
cnt
);
put
(
0
,
0
,
a
);
int
cnt
=
a
.
length
/
ch
;
create
(
cnt
);
put
(
0
,
0
,
a
);
}
}
public
int
[]
toArray
(
int
[]
a
)
{
public
int
[]
to
Primitive
Array
(
int
[]
a
)
{
int
cnt
=
(
int
)
total
()
*
channels
;
if
(
cnt
==
0
)
return
new
int
[
0
];
//null;
...
...
modules/java/src/java/core+CvVectorKeyPoint.java
View file @
0c45a5ad
...
...
@@ -25,7 +25,7 @@ public class CvVectorKeyPoint extends CvVectorFloat {
create
(
cnt
);
float
buff
[]
=
new
float
[
_ch
*
cnt
];
for
(
int
i
=
0
;
i
<
cnt
;
i
++)
{
KeyPoint
kp
=
a
[
i
];
KeyPoint
kp
=
a
[
i
];
buff
[
_ch
*
i
+
0
]
=
(
float
)
kp
.
pt
.
x
;
buff
[
_ch
*
i
+
1
]
=
(
float
)
kp
.
pt
.
y
;
buff
[
_ch
*
i
+
2
]
=
kp
.
size
;
...
...
@@ -38,7 +38,7 @@ public class CvVectorKeyPoint extends CvVectorFloat {
}
public
KeyPoint
[]
toArray
(
KeyPoint
[]
a
)
{
float
buff
[]
=
super
.
to
Array
(
null
);
float
buff
[]
=
super
.
toPrimitive
Array
(
null
);
if
(
buff
.
length
==
0
)
return
new
KeyPoint
[
0
];
//null;
int
cnt
=
buff
.
length
/
_ch
;
...
...
@@ -47,7 +47,7 @@ public class CvVectorKeyPoint extends CvVectorFloat {
res
=
new
KeyPoint
[
cnt
];
for
(
int
i
=
0
;
i
<
cnt
;
i
++)
res
[
i
]
=
new
KeyPoint
(
buff
[
_ch
*
i
+
0
],
buff
[
_ch
*
i
+
1
],
buff
[
_ch
*
i
+
2
],
buff
[
_ch
*
i
+
3
],
buff
[
_ch
*
i
+
4
],
(
int
)
buff
[
_ch
*
i
+
5
],
(
int
)
buff
[
_ch
*
i
+
6
]
);
buff
[
_ch
*
i
+
4
],
(
int
)
buff
[
_ch
*
i
+
5
],
(
int
)
buff
[
_ch
*
i
+
6
]
);
return
res
;
}
}
modules/java/src/java/core+CvVectorPoint.java
View file @
0c45a5ad
...
...
@@ -23,7 +23,7 @@ public class CvVectorPoint extends CvVectorInt {
create
(
cnt
);
int
buff
[]
=
new
int
[
_ch
*
cnt
];
for
(
int
i
=
0
;
i
<
cnt
;
i
++)
{
Point
p
=
a
[
i
];
Point
p
=
a
[
i
];
buff
[
_ch
*
i
+
0
]
=
(
int
)
p
.
x
;
buff
[
_ch
*
i
+
1
]
=
(
int
)
p
.
y
;
}
...
...
@@ -31,7 +31,7 @@ public class CvVectorPoint extends CvVectorInt {
}
public
Point
[]
toArray
(
Point
[]
a
)
{
int
buff
[]
=
super
.
toArray
(
null
);
int
buff
[]
=
super
.
to
Primitive
Array
(
null
);
if
(
buff
.
length
==
0
)
return
new
Point
[
0
];
//null;
int
cnt
=
buff
.
length
/
_ch
;
...
...
modules/java/src/java/core+CvVectorPoint2f.java
View file @
0c45a5ad
...
...
@@ -23,7 +23,7 @@ public class CvVectorPoint2f extends CvVectorFloat {
create
(
cnt
);
float
buff
[]
=
new
float
[
_ch
*
cnt
];
for
(
int
i
=
0
;
i
<
cnt
;
i
++)
{
Point
p
=
a
[
i
];
Point
p
=
a
[
i
];
buff
[
_ch
*
i
+
0
]
=
(
float
)
p
.
x
;
buff
[
_ch
*
i
+
1
]
=
(
float
)
p
.
y
;
}
...
...
@@ -31,7 +31,7 @@ public class CvVectorPoint2f extends CvVectorFloat {
}
public
Point
[]
toArray
(
Point
[]
a
)
{
float
buff
[]
=
super
.
toArray
(
null
);
float
buff
[]
=
super
.
to
Primitive
Array
(
null
);
if
(
buff
.
length
==
0
)
return
new
Point
[
0
];
//null;
int
cnt
=
buff
.
length
/
_ch
;
...
...
modules/java/src/java/core+CvVectorPoint3.java
View file @
0c45a5ad
...
...
@@ -23,7 +23,7 @@ public class CvVectorPoint3 extends CvVectorInt {
create
(
cnt
);
int
buff
[]
=
new
int
[
_ch
*
cnt
];
for
(
int
i
=
0
;
i
<
cnt
;
i
++)
{
Point3
p
=
a
[
i
];
Point3
p
=
a
[
i
];
buff
[
_ch
*
i
]
=
(
int
)
p
.
x
;
buff
[
_ch
*
i
+
1
]
=
(
int
)
p
.
y
;
buff
[
_ch
*
i
+
2
]
=
(
int
)
p
.
z
;
...
...
@@ -32,7 +32,7 @@ public class CvVectorPoint3 extends CvVectorInt {
}
public
Point3
[]
toArray
(
Point3
[]
a
)
{
int
buff
[]
=
super
.
toArray
(
null
);
int
buff
[]
=
super
.
to
Primitive
Array
(
null
);
if
(
buff
.
length
==
0
)
return
new
Point3
[
0
];
//null;
int
cnt
=
buff
.
length
/
_ch
;
...
...
modules/java/src/java/core+CvVectorPoint3f.java
View file @
0c45a5ad
...
...
@@ -23,7 +23,7 @@ public class CvVectorPoint3f extends CvVectorFloat {
create
(
cnt
);
float
buff
[]
=
new
float
[
_ch
*
cnt
];
for
(
int
i
=
0
;
i
<
cnt
;
i
++)
{
Point3
p
=
a
[
i
];
Point3
p
=
a
[
i
];
buff
[
_ch
*
i
]
=
(
float
)
p
.
x
;
buff
[
_ch
*
i
+
1
]
=
(
float
)
p
.
y
;
buff
[
_ch
*
i
+
2
]
=
(
float
)
p
.
z
;
...
...
@@ -32,7 +32,7 @@ public class CvVectorPoint3f extends CvVectorFloat {
}
public
Point3
[]
toArray
(
Point3
[]
a
)
{
float
buff
[]
=
super
.
toArray
(
null
);
float
buff
[]
=
super
.
to
Primitive
Array
(
null
);
if
(
buff
.
length
==
0
)
return
new
Point3
[
0
];
//null;
int
cnt
=
buff
.
length
/
_ch
;
...
...
modules/java/src/java/core+CvVectorRect.java
View file @
0c45a5ad
...
...
@@ -24,7 +24,7 @@ public class CvVectorRect extends CvVectorInt {
create
(
cnt
);
int
buff
[]
=
new
int
[
_ch
*
cnt
];
for
(
int
i
=
0
;
i
<
cnt
;
i
++)
{
Rect
r
=
a
[
i
];
Rect
r
=
a
[
i
];
buff
[
_ch
*
i
]
=
r
.
x
;
buff
[
_ch
*
i
+
1
]
=
r
.
y
;
buff
[
_ch
*
i
+
2
]
=
r
.
width
;
...
...
@@ -34,7 +34,7 @@ public class CvVectorRect extends CvVectorInt {
}
public
Rect
[]
toArray
(
Rect
[]
a
)
{
int
buff
[]
=
super
.
toArray
(
null
);
int
buff
[]
=
super
.
to
Primitive
Array
(
null
);
if
(
buff
.
length
==
0
)
return
new
Rect
[
0
];
//null;
int
cnt
=
buff
.
length
/
_ch
;
...
...
samples/android/face-detection/src/org/opencv/samples/fd/FdView.java
View file @
0c45a5ad
...
...
@@ -84,8 +84,7 @@ class FdView extends SampleCvViewBase {
mCascade
.
detectMultiScale
(
mGray
,
faces
,
1.1
,
2
,
2
// TODO: objdetect.CV_HAAR_SCALE_IMAGE
,
new
Size
(
faceSize
,
faceSize
),
new
Size
());
Rect
ra
[]
=
null
;
for
(
Rect
r
:
faces
.
toArray
(
ra
))
for
(
Rect
r
:
faces
.
toArray
(
null
))
Core
.
rectangle
(
mRgba
,
r
.
tl
(),
r
.
br
(),
new
Scalar
(
0
,
255
,
0
,
255
),
3
);
}
...
...
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