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
1b252570
Commit
1b252570
authored
Mar 23, 2012
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java API minor fixes
parent
a97c2c83
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
33 deletions
+51
-33
CoreTest.java
.../java/android_test/src/org/opencv/test/core/CoreTest.java
+16
-20
ImgprocTest.java
...android_test/src/org/opencv/test/imgproc/ImgprocTest.java
+17
-11
gen_java.py
modules/java/gen_java.py
+2
-2
utils+Converters.java
modules/java/src/java/utils+Converters.java
+16
-0
No files found.
modules/java/android_test/src/org/opencv/test/core/CoreTest.java
View file @
1b252570
...
...
@@ -1190,23 +1190,18 @@ public class CoreTest extends OpenCVTestCase {
}
public
void
testMeanStdDevMatMatMat
()
{
Mat
mean
=
new
Mat
();
Mat
stddev
=
new
Mat
();
List
<
Double
>
mean
=
new
ArrayList
<
Double
>
();
List
<
Double
>
stddev
=
new
ArrayList
<
Double
>
();
Core
.
meanStdDev
(
rgbLena
,
mean
,
stddev
);
Mat
expectedMean
=
new
Mat
(
3
,
1
,
CvType
.
CV_64F
)
{
{
put
(
0
,
0
,
105.3989906311035
,
99.56269836425781
,
179.7303047180176
);
}
};
Mat
expectedDev
=
new
Mat
(
3
,
1
,
CvType
.
CV_64F
)
{
{
put
(
0
,
0
,
33.74205485167219
,
52.8734582803278
,
49.01569488056406
);
}
};
assertMatEqual
(
expectedMean
,
mean
,
EPS
);
assertMatEqual
(
expectedDev
,
stddev
,
EPS
);
List
<
Double
>
expectedMean
=
Arrays
.
asList
(
new
Double
[]
{
105.3989906311035
,
99.56269836425781
,
179.7303047180176
}
);
List
<
Double
>
expectedDev
=
Arrays
.
asList
(
new
Double
[]
{
33.74205485167219
,
52.8734582803278
,
49.01569488056406
}
);
assertListEquals
(
expectedMean
,
mean
,
EPS
);
assertListEquals
(
expectedDev
,
stddev
,
EPS
);
}
public
void
testMeanStdDevMatMatMatMat
()
{
...
...
@@ -1215,15 +1210,16 @@ public class CoreTest extends OpenCVTestCase {
Mat
mask
=
gray0
.
clone
();
submat
=
mask
.
submat
(
0
,
mask
.
rows
()
/
2
,
0
,
mask
.
cols
()
/
2
);
submat
.
setTo
(
new
Scalar
(
1
));
Mat
mean
=
new
Mat
();
Mat
stddev
=
new
Mat
();
List
<
Double
>
mean
=
new
ArrayList
<
Double
>
();
List
<
Double
>
stddev
=
new
ArrayList
<
Double
>
();
Core
.
meanStdDev
(
grayRnd
,
mean
,
stddev
,
mask
);
Mat
expectedMean
=
new
Mat
(
1
,
1
,
CvType
.
CV_64F
,
new
Scalar
(
33
));
Mat
expectedDev
=
new
Mat
(
1
,
1
,
CvType
.
CV_64F
,
new
Scalar
(
0
));
assertMatEqual
(
expectedMean
,
mean
,
EPS
);
assertMatEqual
(
expectedDev
,
stddev
,
EPS
);
List
<
Double
>
expectedMean
=
Arrays
.
asList
(
new
Double
[]
{
33
d
}
);
List
<
Double
>
expectedDev
=
Arrays
.
asList
(
new
Double
[]
{
0
d
}
);
assertListEquals
(
expectedMean
,
mean
,
EPS
);
assertListEquals
(
expectedDev
,
stddev
,
EPS
);
}
public
void
testMerge
()
{
...
...
modules/java/android_test/src/org/opencv/test/imgproc/ImgprocTest.java
View file @
1b252570
...
...
@@ -141,17 +141,23 @@ public class ImgprocTest extends OpenCVTestCase {
}
public
void
testApproxPolyDP
()
{
Mat
curve
=
new
Mat
(
1
,
5
,
CvType
.
CV_32FC2
);
curve
.
put
(
0
,
0
,
1
,
3
,
2
,
4
,
3
,
5
,
4
,
4
,
5
,
3
);
Imgproc
.
approxPolyDP
(
curve
,
dst
,
EPS
,
true
);
Mat
approxCurve
=
new
Mat
(
3
,
1
,
CvType
.
CV_32FC2
)
{
{
put
(
0
,
0
,
1
,
3
,
3
,
5
,
5
,
3
);
}
};
assertMatEqual
(
approxCurve
,
dst
,
EPS
);
List
<
Point
>
curve
=
new
ArrayList
<
Point
>(
5
);
curve
.
add
(
new
Point
(
1
,
3
));
curve
.
add
(
new
Point
(
2
,
4
));
curve
.
add
(
new
Point
(
3
,
5
));
curve
.
add
(
new
Point
(
4
,
4
));
curve
.
add
(
new
Point
(
5
,
3
));
List
<
Point
>
approxCurve
=
new
ArrayList
<
Point
>();
Imgproc
.
approxPolyDP
(
curve
,
approxCurve
,
EPS
,
true
);
List
<
Point
>
approxCurveGold
=
new
ArrayList
<
Point
>(
3
);
approxCurveGold
.
add
(
new
Point
(
1
,
3
));
approxCurveGold
.
add
(
new
Point
(
3
,
5
));
approxCurveGold
.
add
(
new
Point
(
5
,
3
));
assertListPointEquals
(
approxCurve
,
approxCurveGold
,
EPS
);
}
public
void
testArcLength
()
{
...
...
modules/java/gen_java.py
View file @
1b252570
...
...
@@ -508,7 +508,7 @@ func_arg_fix = {
'polylines'
:
{
'pts'
:
'vector_vector_Point'
,
},
'fillConvexPoly'
:
{
'points'
:
'vector_Point'
,
},
'boundingRect'
:
{
'points'
:
'vector_Point'
,
},
#'approxPolyDP' : { 'curve' : 'vector_Point2f', 'CV_OUT
approxCurve' : 'vector_Point2f', },
'approxPolyDP'
:
{
'curve'
:
'vector_Point2f'
,
'
approxCurve'
:
'vector_Point2f'
,
},
'arcLength'
:
{
'curve'
:
'vector_Point2f'
,
},
'isContourConvex'
:
{
'contour'
:
'vector_Point2f'
,
},
'pointPolygonTest'
:
{
'contour'
:
'vector_Point2f'
,
},
...
...
@@ -518,7 +518,7 @@ func_arg_fix = {
'vconcat'
:
{
'src'
:
'vector_Mat'
,
},
'undistortPoints'
:
{
'src'
:
'vector_Point2d'
,
'dst'
:
'vector_Point2d'
},
'checkRange'
:
{
'pos'
:
'*'
},
#'meanStdDev' : {'mean' : 'Scalar', 'stddev' : 'Scalar
'},
'meanStdDev'
:
{
'mean'
:
'vector_double'
,
'stddev'
:
'vector_double
'
},
},
# '', i.e. no class
}
# func_arg_fix
...
...
modules/java/src/java/utils+Converters.java
View file @
1b252570
...
...
@@ -547,6 +547,22 @@ public class Converters {
return
res
;
}
public
static
void
Mat_to_vector_double
(
Mat
m
,
List
<
Double
>
ds
)
{
if
(
ds
==
null
)
throw
new
java
.
lang
.
IllegalArgumentException
(
"ds == null"
);
int
count
=
m
.
rows
();
if
(
CvType
.
CV_64FC1
!=
m
.
type
()
||
m
.
cols
()
!=
1
)
throw
new
java
.
lang
.
IllegalArgumentException
(
"CvType.CV_64FC1 != m.type() || m.cols()!=1\n"
+
m
);
ds
.
clear
();
double
[]
buff
=
new
double
[
count
];
m
.
get
(
0
,
0
,
buff
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
ds
.
add
(
buff
[
i
]);
}
}
public
static
Mat
vector_DMatch_to_Mat
(
List
<
DMatch
>
matches
)
{
Mat
res
;
int
count
=
(
matches
!=
null
)
?
matches
.
size
()
:
0
;
...
...
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