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
790ff8f4
Commit
790ff8f4
authored
Aug 03, 2011
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java API: minEnclosingCircle() fixed (float& -> float[])
Testing: 1130/0/584
parent
e1cd84bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
12 deletions
+23
-12
imgprocTest.java
...android_test/src/org/opencv/test/imgproc/imgprocTest.java
+2
-2
gen_java.py
modules/java/gen_java.py
+21
-10
No files found.
modules/java/android_test/src/org/opencv/test/imgproc/imgprocTest.java
View file @
790ff8f4
...
...
@@ -1414,14 +1414,14 @@ public class imgprocTest extends OpenCVTestCase {
points
.
add
(
new
Point
(
0
,
1
));
Point
actualCenter
=
new
Point
();
float
radius
=
347.0f
;
// FIXME: Unexpected radius is returned i.e 0
float
[]
radius
=
new
float
[]{
347.0f
};
Imgproc
.
minEnclosingCircle
(
points
,
actualCenter
,
radius
);
Point
truthCenter
=
new
Point
(
0
,
0
);
assertEquals
(
truthCenter
,
actualCenter
);
float
truthRadius
=
1.0f
;
assertEquals
(
truthRadius
,
radius
,
weakEPS
);
assertEquals
(
truthRadius
,
radius
[
0
]
,
weakEPS
);
}
public
void
testMomentsMat
()
{
...
...
modules/java/gen_java.py
View file @
790ff8f4
...
...
@@ -876,7 +876,7 @@ extern "C" {
args
=
fi
.
args
[:]
# copy
suffix_counter
=
int
(
self
.
classes
[
fi
.
classname
or
self
.
Module
]
.
methods_suffixes
.
get
(
fi
.
jname
,
-
1
)
)
while
True
:
suffix_counter
=
suffix_counter
+
1
suffix_counter
+=
1
self
.
classes
[
fi
.
classname
or
self
.
Module
]
.
methods_suffixes
[
fi
.
jname
]
=
suffix_counter
# java native method args
jn_args
=
[]
...
...
@@ -923,17 +923,20 @@ extern "C" {
jn_args
.
append
(
ArgInfo
([
"double[]"
,
"
%
s_out"
%
a
.
name
,
""
,
[],
""
])
)
jni_args
.
append
(
ArgInfo
([
"double[]"
,
"
%
s_out"
%
a
.
name
,
""
,
[],
""
])
)
j_prologue
.
append
(
"double[]
%
s_out = new double[
%
i];"
%
(
a
.
name
,
len
(
fields
))
)
set_vals
=
[]
i
=
0
for
f
in
fields
:
set_vals
.
append
(
"
%(n)
s
%(f)
s =
%(t)
s
%(n)
s_out[
%(i)
i]"
%
{
"n"
:
a
.
name
,
"t"
:
(
"("
+
type_dict
[
f
[
0
]][
"j_type"
]
+
")"
,
""
)[
f
[
0
]
==
"double"
],
"f"
:
f
[
1
],
"i"
:
i
}
)
i
+=
1
j_epilogue
.
append
(
"; "
.
join
(
set_vals
)
+
"; "
)
c_epilogue
.
append
(
\
"jdouble tmp_
%(n)
s[
%(cnt)
i] = {
%(args)
s}; env->SetDoubleArrayRegion(
%(n)
s_out, 0,
%(cnt)
i, tmp_
%(n)
s);"
%
{
"n"
:
a
.
name
,
"cnt"
:
len
(
fields
),
"args"
:
", "
.
join
([
a
.
name
+
f
[
1
]
for
f
in
fields
])
}
)
if
a
.
ctype
in
(
'bool'
,
'int'
,
'long'
,
'float'
,
'double'
):
j_epilogue
.
append
(
'if(
%(n)
s!=null)
%(n)
s[0] = (
%(t)
s)
%(n)
s_out[0];'
%
{
'n'
:
a
.
name
,
't'
:
a
.
ctype
})
else
:
set_vals
=
[]
i
=
0
for
f
in
fields
:
set_vals
.
append
(
"
%(n)
s
%(f)
s =
%(t)
s
%(n)
s_out[
%(i)
i]"
%
{
"n"
:
a
.
name
,
"t"
:
(
"("
+
type_dict
[
f
[
0
]][
"j_type"
]
+
")"
,
""
)[
f
[
0
]
==
"double"
],
"f"
:
f
[
1
],
"i"
:
i
}
)
i
+=
1
j_epilogue
.
append
(
"if("
+
a
.
name
+
"!=null){ "
+
"; "
.
join
(
set_vals
)
+
"; } "
)
# java part:
...
...
@@ -990,6 +993,13 @@ extern "C" {
if
fi
.
classname
:
static
=
fi
.
static
j_args
=
[]
for
a
in
args
:
jt
=
type_dict
[
a
.
ctype
][
"j_type"
]
if
a
.
out
and
a
.
ctype
in
(
'bool'
,
'int'
,
'long'
,
'float'
,
'double'
):
jt
+=
'[]'
j_args
.
append
(
jt
+
' '
+
a
.
name
)
j_code
.
write
(
Template
(
\
""" public $static $j_type $j_name($j_args)
{
...
...
@@ -1009,12 +1019,13 @@ extern "C" {
static
=
static
,
\
j_type
=
type_dict
[
fi
.
ctype
][
"j_type"
],
\
j_name
=
fi
.
jname
,
\
j_args
=
", "
.
join
(
[
"
%
s
%
s"
%
(
type_dict
[
a
.
ctype
][
"j_type"
],
a
.
name
)
for
a
in
args
]
),
\
j_args
=
", "
.
join
(
j_args
),
\
jn_name
=
fi
.
jname
+
'_'
+
str
(
suffix_counter
),
\
jn_args_call
=
", "
.
join
(
[
a
.
name
for
a
in
jn_args
]
),
\
)
)
# cpp part:
# jni_func(..) { _retval_ = cv_func(..); return _retval_; }
ret
=
"return _retval_;"
...
...
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